我正在集成一个 PHP 代码来将站点地图 ping 到谷歌和 Bing。代码执行完美,但如果我从 ajax 调用发起请求,那将是事实。它不会返回
下面是我用来进行 ajax 调用的 Jquery 代码
$("body").on('click', 'button#sitemap_google_submit', function(event){
toastr.info("Would require few seconds, Please wait, do not refresh Page..",
"Submitting Sitemap to Google!",
{ progressBar:!0,
showMethod:"slideDown",
hideMethod:"slideUp",
timeOut:2e3,
preventDuplicates: true,
positionClass: "toast-bottom-right"
}
);
$("button#sitemap_google_submit").attr("disabled", true);
$("button#sitemap_google_submit").html("<i class='ft-loader spinner'></i> Submitting to Google..");
$.ajax({
url: '/bypasser/modules/seoController.php',
type: 'POST',
dataType: 'JSON',
data: {type: 'submit', console: 'google'},
})
.done(function(resp) {
$("button#sitemap_google_submit").attr("disabled", false);
$("button#sitemap_google_submit").html("<i class='fa fa-google fa-lg'></i> Submit to Google");
toastr[resp.type](resp.message,
resp.heading,
{ showMethod:"slideDown",
hideMethod:"slideUp",
preventDuplicates: true,
positionClass: "toast-bottom-right"
});
});
});
JSON 编码在检查元素的网络选项卡的预览面板中完美显示,但不知何故它不返回对 ajax 的响应,这是什么问题?
SMILET