一種是ajax傳值,另外一種是post傳值,html
ajax傳值:ajax
$.ajax({
url: "AjaxTxt/Fild.ashx?Name=duibi&dates=" suzkr"&tdds=" suztd」,
type: "post",
success: function (date) {
var u = $.parseJSON(date);app
}post
}):ui
post直接傳值:url
function post(url, params) {
var temp = document.createElement("form");
temp.action = url;
temp.method = "post";
temp.style.display = "none";
for (var x in params) {
var opt = document.createElement("input");
opt.name = x;
opt.value = params[x];
temp.appendChild(opt);
}
document.body.appendChild(temp);
temp.submit();
return temp;
}spa
//調用方法 如
post('pages/statisticsJsp/excel.action', { html: prnhtml, cm1: 'sdsddsd', cm2: 'haha' });excel