我似乎在通过URL的字符串发送时遇到问题。该URL看起来是这样的:通过URL字符串发送的JQuery Ajax
其发送JS里面所有的信息,但它只是看起来像这样一旦进入到PHP页面:
我的阿贾克斯是这样设置的:
jQuery.ajax({
type: "POST",
dataType: "html",
data: "type=add" + "&1A=" + pubName + "&1B=" + postID + "&1C=" + PostTitle + "&1D=" + timeStamp + "&1E=" + pdfLink + "&1F=" + imgLink + "&1G=" + fullArticleLink,
url: "../wp-content/plugins/visual-editor-custom-buttons/js/wpDataSend.php",
success: function(results) {
if (results.indexOf("done") >= 0) {
showNotifier(8000,'#43d32b','Title, Pub Name, Image, Date, PDF & Article link have been saved!');
} else {
showNotifier(8000,'#d32b2b','Could not save... Please try again!');
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log("Status: " + textStatus);
console.log("Error: " + errorThrown);
showNotifier(8000,'#d32b2b','Error: ' + textStatus + ' | ' + errorThrown);
}
});
,我来自PHP页面收集了数据,像这样:
$newtype = $_POST['type'];
$pubName = $_POST['1A'];
$postID = $_POST['1B'];
$PostTitle = $_POST['1C'];
$timeStamp = $_POST['1D'];
$pdfLink = $_POST['1E'];
$imgLink = $_POST['1F'];
$Fullarticle = $_POST['1G'];
我如何纠正呢?
你正在发布到“wpDataSend.php”,但得到“dirhere.asp”?什么是实际的网址?你发送一个'sid'参数吗? – Emmett 2013-03-21 14:08:22
@Emmett这只是一个链接。与发送数据的.php页面无关。 – StealthRT 2013-03-21 14:10:29