开发者

PHP back-end not receiving backbone.js POST

开发者 https://www.devze.com 2023-03-14 01:58 出处:网络
Using backbone.js, I call model.save() and through firebug I see that my model\'s JSON string is indeed POSTed to the model URL.

Using backbone.js, I call model.save() and through firebug I see that my model's JSON string is indeed POSTed to the model URL.

I tried looking in all variables but couldn't find any data. $_REQUEST shows POST is the method. But $_POST is completely empty.

I'm using a very simple PHP page:

<?php
var_dump($_GET);
var_dump($_POST);
var_dump($_REQUEST);
?>

The response to the save/sync call is

array
  empty

array
  empty

array
  empty

How do I get my PHP back-end to receive the model's JSON string that was POSTed? Any help appreciated thanks.

Edit:开发者_JAVA技巧 for anyone interested I did this per Rayno's link:

<?php
    parse_str(file_get_contents("php://input"),$post_vars);
    var_dump($post_vars);
?>


Are you sure they're sent to the server? You can check the communication between browser/server with tools like Fiddler or in Firebugs 'Net' console.

0

精彩评论

暂无评论...
验证码 换一张
取 消