This question makes me puzzled, the post works well on my local server.After I deploy to the server, it works for normal strings. And if there are strings like xxx.xx, error POST 404 will be reported in the server online environment, but the local does not have this problem.
the javascript:
$(function(){
$('#submit-quesAnswer').click(function(){
_qu.answerContent = _qu.ed.input.val();
if(!_qu.answerContent || _qu.answerContent.length<10){
_dialogBox({title:'提示',message:'Thanks for your help! But please answer at least 10 strings.'});return false;
}
$('#submit-quesAnswer').attr('disabled','true').html('Processing');
submitAnswer();
});
});
function submitAnswer(){
$.ajax({
type:'POST',url:"/lib/php/question/answer.php",
data:{
action:'submit',qid:_qu.id,content:_qu.answerContent
}
}).done(function(str){
$('#submit-quesAnswer').removeAttr('disabled').html('提交回答');
let resp;
try{resp = JSON.parse(str);} catch(err){
_dialogBox({title:'出错啦!',message:str});return;
}
if(resp.status=='success'){
$('#submit-quesAnswer').attr('disabled','true').html('提交成功');
gxz.storage.remove(_qu.ed.autoSave.name);
_dialogBox({
title:'回答提交成功啦!',message:"<p>感谢你的无私帮助!小蔗将在 5 秒内为你进行跳转。</p>",
yes:function(){window.location.reload();}
});
setTimeout(()=>{window.location.reload();},5000);
} else {
_dialogBox({title:'提交失败: '+resp.status,message:resp.reason});
}
});
}
the example error data: (_qu.answerContent)
data modify block ~ 255 ~ Items[0].id set from entity @s SelectedItem.id
data modify block ~ 255 ~ Items[0].tag set from entity @s SelectedItem.tag
Hoever,this data is fine:
data modify block ~ 255 ~ Items[0].id set from entity @s SelectedItem.id
Online server report an error like: jquery.min.js:2 POST https://www.mcadmin.cn/lib/php/question/answer.php 404 (Not Found)
So, why does this string only cause the server to report an error?