[英]Passing JSON object from ajax to PHP script
I am currently trying to pass a json object from ajax to php. 我目前正在尝试将json对象从ajax传递到php。 But it does not get me anything..Below is my code. 但这并没有给我任何东西。下面是我的代码。 I already tried print_r[$_POST]
it just returns Array()
. 我已经尝试过print_r[$_POST]
它只返回Array()
。 What's wrong with this code? 此代码有什么问题?
This is my code: screenshot of my code 这是我的代码:我的代码的屏幕截图
If ajax is sent with "GET" instead of "POST", you should use $ _GET in your code. 如果使用“ GET”而不是“ POST”发送ajax,则应在代码中使用$ _GET。
$.ajax({
type: "POST",
url: url,
data: data,
success: success,
dataType: dataType
});
Are you sure that the Type parameter is post? 您确定Type参数是post吗?
or use 或使用
print_r($_GET);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.