简体   繁体   中英

My Json get cut off when sent with Ajax

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.

 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:

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

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

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

and that itself must be cut off.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM