与Ajax一起发送时,我的Json被切断了

时间:2022-10-17 22:17:34

I'm using angular to save new data on the database, I take the data from my inputs, put it in a object and I convert it to a Json, I send it by POST, but my JSON gets cut off and I have no clue why is it happening.

我正在使用angular来保存数据库中的新数据,我从输入中获取数据,将其放入对象中并将其转换为Json,我通过POST发送它,但我的JSON被切断了,我没有想知道为什么会这样。

 var myJson = angular.toJson(myObject);
 $http({
   method: 'POST',
   url: 'http://url/file.php',
   data: {
     'data': myJson
   }
 })
 .success(function (data){
    console.log(data);
  })

My file.php has a var_dump($_POST) in it, and it shows that:

我的file.php中有一个var_dump($ _ POST),它显示:

[
  {
    "uuid":"56456456456456456456465456"
  },
  {
    "store_name":"",
    "store_email":"",
    "store_facebook":"",
    "contact_name":"John Doe",
    "contact_email":"email@email.com",
    "contact_facebook":"http://localho

1 个解决方案

#1


0  

Angular's http post method sends whatever data it is passed to. You should check your generated json data after

Angular的http post方法发送传递给它的任何数据。你应该检查你生成的json数据

var myJson = angular.toJson(myObject); using console.log(myJson);

var myJson = angular.toJson(myObject);使用console.log(myJson);

and that itself must be cut off.

而且这本身必须被切断。

#1


0  

Angular's http post method sends whatever data it is passed to. You should check your generated json data after

Angular的http post方法发送传递给它的任何数据。你应该检查你生成的json数据

var myJson = angular.toJson(myObject); using console.log(myJson);

var myJson = angular.toJson(myObject);使用console.log(myJson);

and that itself must be cut off.

而且这本身必须被切断。