$.ajax的beforeSend,success, complete,error例子
jquery ajax官方文件: http://api.jquery.com/jquery.ajax/
常用的ajax形式:
$.ajax({
url: "http://192.168.2.46:8000/account/getjson/",
type: "post",
dataType: "json", // 跨域使用jsonp
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
data: {
"user": "admin",
"password": "123456"
},
beforeSend: function(XMLHttpRequest) {
// do something...
return true;
},
success: function(data) {
// alert(JSON.stringify(data));
// do something...
},
complete: function(XMLHttpRequest, textStatus) {
// textStatus的值:success, notmodified, nocontent, error, timeout, abort, parsererror
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
// textStatus的值:null, timeout, error, abort, parsererror
// errorThrown的值:收到http出錯文字,如 Not Found 或 Internal Server Error
}
});
相關文章
- jQuery ajax中success和complete區別jQuery
- ajax詳解及例子
- Ajax 請求後,with('success','msg'),前臺重新整理沒反應
- 一個簡單的Ajax請求例子
- CHECK_NRPE: Error - Could not complete SSL handshake.Error
- Check failed: status == CUDNN_STATUS_SUCCESS (4 vs. 0) CUDNN_STATUS_INTERNAL_ERRORAIDNNError
- IDBRequest success 事件事件
- jQuery Validate success()jQuery
- A Map to Success: Functors in JavascriptJavaScript
- Ext success failure 呼叫AI
- check ftp success scriptFTP
- nagios 升級遇到的坑 CHECK_NRPE: Error - Could not complete SSL handshake.iOSError
- Opportunity的chance of success的賦值邏輯Unity賦值
- Code Complete (轉)
- FSM:The complete FSM
- Realcase: Failed to upgrade SQL Server 2016 SP2 CU11. (Installation success or error status: 1648)AISQLServerError
- Ajax 什麼是Ajax? Ajax的基本語法
- redis:auto-completeRedis
- The complete timer
- 10. Does luck have anything to do with success?
- Code Complete部分筆記筆記
- How to get complete sessions informationSessionORM
- Javacc的例子Java
- sqlldr的例子SQL
- Code Complete — 建立高質量的程式碼
- 《Code Complete》讀書筆記筆記
- npm A complete log of this run can be found inNPM
- ACCOMPLISH vs COMPLETE coca 搭配
- 來了解一下Ajax是什麼?Ajax的原理?Ajax與傳統Web比較?Ajax的優缺點?Ajax的Post與Get比較Web
- “finally block does not complete normally”的警告解決BloCORM
- 常見的Checkpoint not complete問題分析解決
- JSONP的例子JSON
- GetMemory的典型例子
- at new 的使用例子
- SpringBoot+ajax踩的坑Error resolving template, template might not exist or might not be accessibleSpring BootError
- JavaScript中的AJAXJavaScript
- Cannot complete applications logonAPPGo
- 原聲ajax與jquery ajax請求的區別jQuery