05-解决方案
16.1.2 解决方案
下面是简单的Ajax请求:
(function($) {
$(document).ready(function() {
$('#update').click(function() {
$.ajax({
type: 'GET',
url: 'hello-ajax.html',
dataType: 'html',
success: function(html, textStatus) {
$('body').append(html);
},
error: function(xhr, textStatus, errorThrown) {
alert('An error occurred! ' + ( errorThrown ? errorThrown:
xhr.status );
}
});
});
});
})(jQuery);