标签:c style class blog code java
给自己的代码优化一下
function Dream_Ajax(url, parms, fuSuccess, fuError, isAsync, isPost, retrueType) { /// <summary>Ajax自定义请求</summary> /// <param name="url" type="string">请求url</param> /// <param name="parms" type="JSON">参数</param> /// <param name="fuSuccess" type="Function">请求成功</param> /// <param name="fuError" type="Function">请求失败(选填)</param> /// <param name="isAsync" type="Bool">是否异步,默认异步(选填)</param> /// <param name="isPost" type="Bool">是否POST,默认POST(选填)</param> /// <param name="retrueType" type="string">返回数据类型,默认JOSN(选填)</param> if (!arguments[0]) { return } var obj = new Object(); obj["isAsync"] = arguments[4] == undefined ? true : arguments[4];//不填写,默认为true异步请求 obj["isPost"] = arguments[5] == undefined ? "POST" : (arguments[5] == true) ? "POST" : "GET";//不填写,默认为Post请求 obj["retrueType"] = arguments[6] == undefined ? "json" : arguments[6];//不填写,默认为json异步请求 var newparms = new Object(); jQuery.extend(newparms, parms);//合并newparms, parms $.ajax({ type: obj["isPost"], async: obj["isAsync"], url: url, data: newparms, dataType: obj["retrueType"], success: fuSuccess, error: fuError }); }
Dream_Ajax(‘/Menu/Delete‘, { ClassID:1}, function (data)
{
});
标签:c style class blog code java
原文地址:http://www.cnblogs.com/chenyongli/p/3769056.html