I trying to get webpage's html by using aja开发者_C百科x function like below.
But it always alert 'error'.
I can't understand why it occur.
I also checked http protocol status using firebug in firefox.
It show me a 200 value.
Plz let me know how to debug it.
$.ajax({
url: "http://news.naver.com/main/home.nhn",
success: function() { alert('success'); },
error: function(jqXHR, textStatus, errorThrown) { alert(textStatus); }
});
Is naver.com your site? If not, then you can't retrieve data from it using AJAX, since you can only make AJAX calls to the same domain as the page you're on.
If that's not the problem, then you'll need to provide more details - like what's inside your arguments in your error function.
精彩评论