1 ajax 函数,p1 为正常函数 function ExecWebFunction(callback,p1) { $.ajax({ type: , contentType: , datatype: , url: URL, data: ajaxdata, beforeSend: function (XMLHttpRequest) { //Specifying this header ensures that the results will be returned as JSON. XMLHttpRequest.setRequestHeader(, ); }, success: function (data, textStatus, XmlHttpRequest) { () { callback(, data.d); } getresult(data.d); }, error: function (XMLHttpRequest, textStatus, errorThrown) { () { callback(, textStatus); } } }); } 2 callback 函数--用来处理上面执行之后的事务. function callback(info, result) { ) { //do somethings } else { //do somethings } } 3 调用方式如下: ExecWebFunction(callback,p1);