我正在使用以下代码通过 ajax 传递和获取数据。
function passdata(id)
{
var top = document.getElementById("tname").value;
var first = document.getElementById("fname").value;
var font_top = document.getElementById("font_top").value;
var font_first = document.getElementById("font_first").value;
var image_top = document.getElementById("image_top").value;
var image_first = document.getElementById("image_first").value;
var poststr = "id=" + id +
"&top=" + top +
"&first=" + first +
"&font_top=" + font_top +
"&font_first=" + font_first +
"&image_top=" + image_top +
"&image_first=" + image_first +
"&actype=getevent";
var reqAddCart = new Subsys_JsHttpRequest_Js();
reqAddCart.onreadystatechange = function() {
if (reqAddCart.readyState == 4) {
if (reqAddCart.responseJS) {
document.location.href = reqAddCart.responseJS.ajax_redirect;
return;
}
else {
//alert(reqAddCart.responseText);
//showModal('abc');
document.getElementById('data_content').innerHTML = reqAddCart.responseText;
result = (reqAddCart.responseText||'');
var brokenresult=result.split("@");
}
}
}
var senddata = new Object();
var url = 'product.php?'+poststr;
//alert(url);
reqAddCart.caching = false;
reqAddCart.open( 'GET', url, true);
reqAddCart.send( senddata );
return false;
}
我正在使用 passdata 函数在产品页面中传递数据。此函数有效,但我的响应速度非常慢。