我想用ajax和php更新mysql记录。我测试了它的工作在本地服务器上总是很好,但有时给实时服务器上的错误,请指导。。。这段代码中的错误有时可以正常工作有时给出错误505错误的getway或有时在live服务器上出现404。。。。。。。。
Ajax function
//=================== Save Data ============================
function savegData()
{
var ProjectId='<?php echo $ProjectId;?>';
var expertId='<?php echo $expertId;?>';
$("#noverlay").fadeIn(100);
alertify.success("Saving...");
$.ajax({
type:'POST',
url:'../save.php',
data:{Projectid:ProjectId,expertid:expertId,
A1a1marks:$("#intellect1").val(),
A1a2marks:$("#intellect2").val(),
A1bmarks:$("#intellect3").val(),
A1cmarks:$("#intellect4").val(),
A1totalmarks:$("#sumIntellect").text(),
A1comments:$("#commentIntellect").val(),
A2amarks:$("#significance1").val(),
A2bmarks:$("#significance2").val(),
A2cmarks:$("#significance3").val(),
A2dmarks:$("#significance4").val(),
A2emarks:$("#significance5").val(),
A2totalmarks:$("#sumSignificance").text(),
A2comments:$("#commentSignificance").val(),
A3amarks:$("#approach1").val(),
A3bmarks:$("#approach2").val(),
A3cmarks:$("#approach3").val(),
A3dmarks:$("#approach4").val(),
A3emarks:$("#approach5").val(),
A3totalmarks:$("#sumApproach").text(),
A3comments:$("#commentApproach").val(),
B1amarks:$("#economic1").val(),
B1bmarks:$("#economic2").val(),
B1cmarks:$("#economic3").val(),
B1dmarks:$("#economic4").val(),
B1emarks:$("#economic5").val(),
B1totalmarks:$("#sumEconomic").text(),
B1comments:$("#commentEconomic").val(),
B2amarks:$("#research1").val(),
B2bmarks:$("#research2").val(),
B2totalmarks:$("#sumResearch").text(),
B2comments:$("#commentResearch").val(),
B3amarks:$("#education1").val(),
B3bmarks:$("#education2").val(),
B3cmarks:$("#education3").val(),
B3dmarks:$("#education4").val(),
B3emarks:$("#education5").val(),
B3totalmarks:$("#sumEducation").text(),
B3comments:$("#commentEducation").val(),
B4amarks:$("#collaboration1").val(),
B4bmarks:$("#collaboration2").val(),
B4cmarks:$("#collaboration3").val(),
B4dmarks:$("#collaboration4").val(),
B4emarks:$("#collaboration5").val(),
B4fmarks:$("#collaboration6").val(),
B4gmarks:$("#collaboration7").val(),
B4hmarks:$("#collaboration8").val(),
B4imarks:$("#collaboration9").val(),
B4totalmarks:$("#sumCollaboration").text(),
B4comments:$("#commentCollaboration").val(),
Camarks:$("#infrastructure1").val(),
Cbmarks:$("#infrastructure2").val(),
Ccmarks:$("#infrastructure3").val(),
Cdmarks:$("#infrastructure4").val(),
Cemarks:$("#infrastructure5").val(),
Ctotalmarks:$("#sumInfrastructure").text(),
Ccomments:$("#commentInfrastructure").val(),
Damarks:$("#reasonability1").val(),
Dbmarks:$("#reasonability2").val(),
Dc1marks:$("#reasonability3").val(),
Dc2marks:$("#reasonability4").val(),
Ddmarks:$("#reasonability5").val(),
Dtotalmarks:$("#sumReasonability").text(),
Dcomments:$("#commentReasonability").val(),
totalmarks:GrandTotal,
totalpercentage:percentage,
piRecommended:$('#budgetRecommended1').val(),
copiRecommended:$('#budgetRecommended2').val(),
phd_studentRecommended:$('#budgetRecommended3').val(),
ms_studentRecommended:$('#budgetRecommended4').val(),
permanentEquipmentRecommended:$('#budgetRecommended5').val(),
expendableSuppliesRecommended:$('#budgetRecommended6').val(),
travelRecommended:$('#budgetRecommended7').val() ,
LDIetcRecommended:$('#budgetRecommended8').val(),
stationaryRecommended:$('#budgetRecommended9').val(),
miscellaneousRecommended:$("#budgetRecommended10").val(),
//otherRecommended:$('#budgetRecommended11').val() ,
secretariatRecommended:$("#budgetRecommended11").val() ,
indirectCostRecommended :$("#budgetRecommended12").val() ,
totalRecommended:$('#totalRecommend').text(),
piComments:$('#budgetReason1').val(),
copiComments:$('#budgetReason2').val(),
phd_studentComments:$('#budgetReason3').val(),
ms_studentComments:$('#budgetReason4').val(),
permanentEquipmentComments:$('#budgetReason5').val(),
expendableSuppliesComments:$('#budgetReason6').val(),
travelComments:$('#budgetReason7').val(),
LDIetcComments:$('#budgetReason8').val(),
stationaryComments:$('#budgetReason9').val() ,
miscellaneousComments:$("#budgetReason10").val() ,
secretariatComments:$("#budgetReason11").val() ,
//Comments:$('#budgetReason11').val() ,
indirectCostComments:$('#budgetReason12').val() ,
decision:previousChecked
},
async:false,
success:function(responce){
setTimeout(function()
{
alertify.success(responce);
$("#noverlay").fadeOut(200);
window.location='reviewReport.php?project_id='+ProjectId+'&expertid='+expertId;
},3000);
},
error: function (error) {
$("#noverlay").fadeOut(200);
console.log(error);
},
});
}
暂无答案!
目前还没有任何答案,快来回答吧!