如果我在评论变量记录中有 + 符号,则未提交。有什么办法可以在 jquery 中编码查询字符串?我尝试了一些方法,但没有奏效
$.ajax({
type: 'post',
url: rootURL + 'services/service.php?method=insertcomment',
data: 'comment=' + comment+'&storyid='+storyid,
dataType: 'json',
success: function (data) {
if(data.code == 200)
$('#success-message')..show();
else
alert('failure');
}
});