JQuery Ajax
http://api.jquery.com/jquery.ajax/
http://www.runoob.com/jquery/jquery-ref-ajax.html
$.ajax({ type: 'POST', url: '<%= ResolveUrl("~/api/Chile/Point/Retrieval") %>', data: JSON.stringify(paras), contentType: 'application/json', beforeSend: function () { $("#btnRetrieval").attr({ disabled: "disabled" }); }, success: function (msg) { $("#btnRetrieval").removeAttr("disabled"); if (msg.IsSuccess) { //$("#modalConfirmated").modal(); window.location.href = "<%= ResolveUrl(CMSContext.GetUrl(OkUrl)) %>"; } else { $("#modelFailedText").html(msg.Message); $("#UpdateModalFailed").modal({ backdrop: 'static' }); } } });
-
type (default:
'GET'
)Type: StringAn alias formethod
. You should usetype
if you're using versions of jQuery prior to 1.9.0.
-
url (default:
The current page
)Type: StringA string containing the URL to which the request is sent.
-
dataData to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See
processData
option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of thetraditional
setting (described below).
-
contentType (default:
'application/x-www-form-urlencoded; charset=UTF-8'
)When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to$.ajax()
, then it is always sent to the server (even if no data is sent). As of jQuery 1.6 you can passfalse
to tell jQuery to not set any content type header. Note: The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding. Note: For cross-domain requests, setting the content type to anything other thanapplication/x-www-form-urlencoded
,multipart/form-data
, ortext/plain
will trigger the browser to send a preflight OPTIONS request to the server.
-
beforeSendA pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning
false
in thebeforeSend
function will cancel the request. As of jQuery 1.5, thebeforeSend
option will be called regardless of the type of request.
-
successA function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the
dataType
parameter or thedataFilter
callback function, if specified; a string describing the status; and thejqXHR
(in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2016-12-19 tableLayoutPanel的使用