我想了解JQuery GET
方法和Angular JS $http GET
方法之间的区别。我不确定这两种方法是否可以根据同步和异步条款进行区分。任何人都可以解释下面这些情况。
角JS代码:
// Simple GET request example:
$http({
method: 'GET',
url: '/someUrl'
}).then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
jQuery代码:
$("button").click(function(){
$.get("demo_test.asp", function(data, status){
alert("Data: " + data + "\nStatus: " + status);
});
});
我的问题是 - 更可靠和易于使用的实施?你建议哪一个?
你到底需要知道什么?这个问题不清楚,请详细说明。 jQuery版本似乎没有错误处理程序(但可以添加一个 - https://api.jquery.com/jquery.get/) - 顺便说一句,它们都是异步调用 – ochi
哦,我明白了!两者都是异步调用。所以你建议我根据表现基准使用哪一个。 @ochi – Chip