Directly on the code, the use of the core code is provided at the end
//---------core key, We love----------// /** * Public: Foundation Support **/ var G = { /** * Unified Request * @parm url Request Server address, format: "${contextpath }/docmanage/list" * @parm  FN callback function, format: function settabletr (data) {for (..) {..}} * @parm parm submitted condition, format: {"name" : "zhangsan", "age": "} **/ " request:function (url,fn,parm) { $.ajax ({ type: "post", async: false, url of url: url, //request dataType: "json ", data: parm, //dynamic execution of this callback function success: function (data) { if (fn!=undefined) fn (data); }, error:function (reslt) { alert ("server, Request Failed. "); } }) } }
Cross-domain request , use the following paragraph of
Unified Request Function request (url,params, fn) { $.ajax ({ type: "get", //jquey is not supported for post mode across domains async: false, url: url, //cross-domain Request URL dataType: "jsonp", The //is passed to the request handler to obtain the parameter name of the JSONP callback function name (default: Callback) jsonp: "callback", data: params, After //successfully obtains the JSON data on a cross-domain server, This callback function is executed dynamically success: function (data) { var result = data.result; if (data.head != ' SUCCESS ') { alert ("server error, Please contact the developer in time!"); return; } if (fn!= Undefined)  FN (result); } });
How to Use:
Request ("http://www.baidu.com", {"money": "100000"},moneycall);
function Moneycall (data) {
Alert (json.stringify (data));
}
Unified Ajax Submission package, once and for all good tools (with Cross-domain Processing)