我想安全地将用户的三个输入从Jquery / Ajax发送到PHP,这是我的代码
var username = encodeURI($(".username_inp").val());
var email = encodeURI($(".email_inp").val());
var pass = encodeURI($(".pass_inp").val());
var post = {
"username":username,
"email":email,
"pass":pass,
}
$.ajax({
url: 'ajax/logreg.php',
type: 'POST',
data: {post:JSON.stringify(post)},
success: function(ans){
console.log(ans);
}
})
我想知道我的代码是否正确,因为据我所知,人们只使用encodeURI
代码