0
私はすべてのajax呼び出しにcsrfトークンを入れていますが、私はajax呼び出しでシリアル化データとJSONデータを渡すときにエラー500を受け取ります。 ビューページには含まれていますが、動作していないため、エラーが発生しています。csrfトークンfor ajax codeigniterでデータをシリアライズ
$("#submit").on('click', function(e) {
e.preventDefault(); // prevent default form submit
if(validateCode()){
$.ajax({
url: 'verifyCode', // form action url
type: 'POST', // form submit method get/post
data: $('#frm').serialize(),
success: function (result) {
result = JSON.parse(result);
if(result.st == 1){
window.location.href="backupCode";
}
else{
$('#validCodeFormat').html("<span style='color:red'>Invalid authentication code.</span>");
}
},
error: function(e) {
}
});
}
});
var json='json={"age":"'+age+'","age1":"'+age1+'","afterTaxincome":"'+aftertaxincome+'","afterTaxincome2":"'+aftertaxincome2+'","annualSave":"'+annualSave+'","annualSave2":"'+annualSave2+'","liqInvest":"'+liqInvest+'","liqInvest2":"'+liqInvest2+'","nonliqassets":"'+nonliqassets+'","nonliqassets2":"'+nonliqassets2+'","totalLia":"'+totalLia+'","totalLia2":"'+totalLia2+'","savingsChange":"'+savingsChange+'","savingsChange2":"'+savingsChange2+'","preference":"'+preference+'","market":"'+market+'","mail":"'+mail+'","investorTypePage":"'+investortype+'"}';
//alert(json);
$.ajax({url: "questions/sendQuestions",
type: "POST",
data: json,
success: function(result){
},
error: function(xhr, status, errMsg) {
alert("error while fetching data from server.\nPlease try again.");
}
});