When I hear people talking about xmlhttprequest or XHR, does it basically mean an ajax call like this, or are there "additional ways" to get xmlhttprequest without using ajax?
$.ajax({
url: 'http://site.com/page'开发者_开发问答,
type: 'POST',
data: { input: 'input' },
success: function(resp) {
}
});
Short answer, yes. Long answer, not even close.
$.ajax is a wrapper to the XHR objects which have different APIs depending on the browser. (FFx, Safari, IE, etc).
eXternalHttpRequest.
Ajax, is Asyncrious Javascript And Xml. (The technical name can vary from person to person. )
Will $.ajax perform the same function as the XHR object? Yes, it is wildly used wrapper and a safe alternative to writing the XHR code to handle each browser.
精彩评论