$.fn.ajaxSend = function (type, url, postdata, onSuccess) { $.ajax({ async: false, url: url, type: type, data: postdata == null|| postdata == "" ? "" : postdata, datatype: "json", cache: false, contentType: "application/json; charset=utf-8", complete: $.OnAjaxComplete, success: function (data) { onSuccess(data); }, error: $.OnAjaxError }); };
使用方法:
function postTest() { $(this).ajaxSend("post", "/ajaxTest1.ashx", "", function (res) { alert(res); }); }
时间: 2024-11-10 10:23:41