Json对象被截断

时间:2016-05-06 13:53:25

标签: json ajax object truncated

我通过ajax将json发送到数据库,我的json长度为320,但只有170个存储在数据库中,它会截断对象的其余部分。

这是我的ajax电话:

$.ajax({
    beforeSend: function() { $('#loading-crud').show(); }, 
    complete: function(){ $('#loading-crud').hide(); },
    type: "POST",
    dataType: "JSON",
    //contentType: "application/json; charset=utf-8",
    url: 'crud_api_curl.php',
    data : {
        data1 : update_project,proname : Proname,projectId : ProjectId,details : Details    
    },
    success: function(data) {
        console.log(data)
        localStorage['projectId']= data.ProjectId;
        var getprojectId = localStorage['projectId'];
        console.log(getprojectId);                  
        if(data == ""){
            $('.top-alert').fadeIn('fast', function () {
            $('.top-alert').css('background-color','#808080').html("not Saved");
            $(this).delay(2000).fadeOut('slow');
            });  
        }
        else{   
            //console.log(data.ProjectDetails);
            var parsej = JSON.parse(data.ProjectDetails);
            console.log(parsej);                    
            $('.top-alert').fadeIn('fast', function () {
                $('.top-alert').css('background-color','#808080').html("Saved");
                $(this).delay(2000).fadeOut('slow');
            }); 
            $('.project-name-container h1').text(projectDetail.projectName);
        }       
    },
    error: function(data){
        console.log(data);
        $('.top-alert').fadeIn('fast', function () {
            $('.top-alert').css('background-color','#808080').html("not Saved");
            $(this).delay(2000).fadeOut('slow');
        });
    }
});

1 个答案:

答案 0 :(得分:0)

我发布了这些消息 $就({

            beforeSend: function() { $('#loading-crud').show(); }, 
            complete: function(){ $('#loading-crud').hide(); },
            type: "POST",
            dataType: "JSON",
            //contentType: "application/json; charset=utf-8",
            url: 'crud_api_curl.php',
            data : {
            data1 : update_project,proname : Proname,projectId : ProjectId,details : Details    
        },


             success: function(data) {
                 console.log(data)
                localStorage['projectId']= data.ProjectId;
                var getprojectId = localStorage['projectId'];
                console.log(getprojectId);                  
                 if(data == ""){
                     $('.top-alert').fadeIn('fast', function () {
                     $('.top-alert').css('background-color','#808080').html("not Saved");
                     $(this).delay(2000).fadeOut('slow');
                });  
                 }
                else{   
                //console.log(data.ProjectDetails);
                var parsej = JSON.parse(data.ProjectDetails);
                console.log(parsej);                    
                     $('.top-alert').fadeIn('fast', function () {
                     $('.top-alert').css('background-color','#808080').html("Saved");
                     $(this).delay(2000).fadeOut('slow');
                }); 
                $('.project-name-container h1').text(projectDetail.projectName);
                }       
             },
             error: function(data){
                 console.log(data);
                     $('.top-alert').fadeIn('fast', function () {
                     $('.top-alert').css('background-color','#808080').html("not Saved");
                     $(this).delay(2000).fadeOut('slow');
                     });
             }
  });