var name = this.value ;
alert(name);
$.ajax({
type: "POST",
url: "<?php echo get_site_url(); ?>/wp-content/themes/dt-the7/home.php",
data :name,
success: function(result){
console.log(result);
}
我正确获取警报值,但在ajax调用中我没有得到输出。
答案 0 :(得分:0)
每次看起来你的ajax请求都不成功。尝试添加错误处理:
var name = this.value ;
alert(name);
$.ajax({
type: "POST",
url: "<?php echo get_site_url(); ?>/wp-content/themes/dt-the7/home.php",
data :name,
success: function(result){
console.log(result);
}
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status);
console.log(thrownError);
}