-1
這個阿賈克斯代碼有時只有工作。請解決我的問題:阿賈克斯偶爾工作
App.controller('sendemail', function (page) {
$.ajax({
type: 'GET',
url: 'http://sanjuwebworks.com/content/9-mobileapps/sendemail.php?callback=response',
// data to be added to query string:
data: { name: 'Zepto.js' },
// type of data we are expecting in return:
dataType: 'jsonp',
timeout: 300,
context: $('body'),
success: function(data){
// Supposing this JSON payload was received:
// {"project": {"id": 42, "html": "<div>..." }}
// append the HTML to context object.
alert(data.success)
console.log('success',data)
},
error: function(xhr, type){
alert('Ajax error!')
}
})
只有時它會提醒並記錄到控制檯,大多數情況下它不響應。
刪除'timeout:300'並重試。 –
是的,300ms超時是不現實的 –
感謝球員,它消除了超時後 –