我似乎在发送 URL 字符串时遇到问题。URL 如下所示:
它在 JS 中发送所有这些信息,但它只有在到达 php 页面后才看起来像这样:
我的 Ajax 设置如下:
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'];
我该如何纠正?