我似乎在通過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