1、ajax
jQuery.ax=function(url, data, async, type, dataType, successfn, errorfn) { async = (async==null || async=="" || typeof(async)=="undefined")? "true" : async; type = (type==null || type=="" || typeof(type)=="undefined")? "post" : type; dataType = (dataType==null || dataType=="" || typeof(dataType)=="undefined")? "json" : dataType; data = (data==null || data=="" || typeof(data)=="undefined")? {"date": new Date().getTime()} : data; $.ajax({ type: type, async: async, data: data, url: url, dataType: dataType, success: function(d){ successfn(d); }, error: function(e){ errorfn(e); } }); };
2、href参数
var param = (function getParam(){ var href = window.location.href; var id = null; var param = {}; if(href.indexOf('?')>-1){ id = href.substring(href.indexOf('?')+1); if(id.indexOf('&&')>-1){ console.log(0) $.each(id.split('&&'),function(i,item){ var info = item.split('='); var cur = info[0]; param[cur]=info[1]; }) } else{ var list = id.split('='); var index = list[0]; param[index]=list[1]; } } return param })();