我通过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');
});
}
});
答案 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');
});
}
});