前端:html+javascript
后端:thinkphp
问题出现在前端提交(+)加号的值后无法识别
旧代码段:
function add_machine(){
var post_data= "machine_type=" + $("#machine_type").val() + "&machine_id=" + $("#machine_id").val();
$.ajax({
type: "POST",
url: "xxx/xxx",
data: post_data,
async:false,
dataType:"json",
statusCode:{
500: function(){
console.log("error:500");
},
404: function(){
console.log("error:404");
},
200: function(result){
}
}
});
}
只需要将上面的data:post_data 稍加修改即可
post_data.replace("+","%2B")
修改后的代码段:
function add_machine(){
var post_data= "machine_type=" + $("#machine_