【发布时间】:2017-07-14 23:09:03
【问题描述】:
我第一次尝试$.post() 方法,已经看过here 的文档,但无法将任何数据发送到我的php 文件。
我的 js 文件上的代码:-
submitHandler: function (form) {
var data = $(form).serialize();
$.post("test.php", function( data ){
//console.log(data);
});
return false;
}
我知道我做错了什么,但无法弄清楚。在我的 php 文件中,var_dump($_REQUEST) 给了我空数组。
【问题讨论】:
-
$.post("test.php", data, function( response ){ //console.log(response); }); return false; } -
成功了 :),谢谢@Anant
-
Rajesh Dey 欢迎 :):)
-
如何从 php 文件中接收任何值。 if($updateUserResult){ $response['userId'] = $userId; } json_encode($response); ,在最近的代码中,我的控制台区域@Anant 是空的。
$updateUserResult是boolean。