Javascript 为什么我的jquery帖子不发送数据?
我知道它没有发送post值,因为在我的php中,有一个echo语句没有被调用Javascript 为什么我的jquery帖子不发送数据?,javascript,php,jquery,ajax,Javascript,Php,Jquery,Ajax,我知道它没有发送post值,因为在我的php中,有一个echo语句没有被调用 function common_set_total(doc_string) { var parser = new DOMParser(); //create a new DOMParser var doc = parser.parseFromString(doc_string, "application/xml"); //convert the string to xml $.ajax ( {
function common_set_total(doc_string)
{
var parser = new DOMParser(); //create a new DOMParser
var doc = parser.parseFromString(doc_string, "application/xml"); //convert the string to xml
$.ajax
(
{
type: "POST",
processData: false,
url: SITE_URL + "/system/xml/price",
data: { xml: doc, apptype: "frame", session_id: session_id}
}
).done(function( msg )
{
$("#total").html("$" + msg); //Set the total
});
}
您是否检查了浏览器控制台以查看请求是否实际通过?会话id来自何处?为什么要将字符串转换为dom,然后在post中将其转换回字符串?我建议您也添加
$.ajax(…).done(…).fail(函数(jqXHR、textStatus、errorshorn){..将它们记录到控制台..})代码>到您的呼叫。这可能会为您提供调试此文件所需的信息。@Eric Wu:它位于同一个域上。
function common_set_total(doc_string)
{
$.ajax
(
{
type: "POST",
processData: false,
url: SITE_URL + "/system/xml/price",
data: "xml=" + doc_string + "&apptype=frame&session_id=" + session_id
}
).done(function( msg )
{
$("#total").html("$" + msg); //Set the total
});
}