将php变量传递给$ .ajax

时间:2019-06-28 23:09:13

标签: php ajax

$ w ='Wayne';如何将$ w php变量传递给$ .ajax?像数据一样:{name:$ w} 这可能吗?

$.ajax({
    type: "post",
    url: 'test.php',
    data: {name: 'Wayne'},
    success: function(data){
        alert(data);
    }
});

0 个答案:

没有答案