[英]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. 我正在使用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
Angular's http post method sends whatever data it is passed to. Angular的http post方法发送传递给它的任何数据。 You should check your generated json data after 您应该在之后检查生成的json数据
var myJson = angular.toJson(myObject);
using console.log(myJson);
使用console.log(myJson);
and that itself must be cut off. 并且必须切断它本身。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.