AJAX
$.ajax({ type : "get", async:false, url : "", dataType : "jsonp", data:{iArea:Global.iArea,subject_id:Global.playerID,type:forecaset,class:1},// 你的formid jsonp: "callback",//传递给请求处理程序或页面的,用以获得jsonp回调函数名的参数名(默认为:callback) //jsonpCallback:"initPlayerList",//自定义的jsonp回调函数名称,默认为jQuery自动生成的随机函数名 success : function(back_data){ console.log(back_data); }, error:function(){ } }); $.ajax({ cache: false, type: "POST", url:"", data:{iArea:Global.iArea,subject_id:Global.playerID,type:forecaset,class:1},// 你的formid async: false, xhrFields: { withCredentials: true }, error: function(request) { alert("Connection error"); }, success: function(data) { data=eval("("+data+")");//转换为json对象 console.log(data); return; if(data.iRet != '0'){ alert(data.sMsg); } else { alert('执行成功'); window.location.reload(); return false; } } });
1
js获取参数
function getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i<vars.length;i++) { var pair = vars[i].split("="); if(pair[0] == variable){return pair[1];} } return(false); }