At least the value emailshould work ...
In any case, do not create the string manually. Set the dataobject containing the values:
data: {name: $('#name').val(), email: $('#email').val()},
// or
data: $('#yourformID').serialize(),
In this way, jQuery will take care of proper escaping.
Also note that identifiers must be unique. If you have other elements with the same identifiers beyond the page, this will not work. Then changes the identifiers.
Update:
. :
var x = document.getElementById("name");
var email = $("input#email").val();
var dataString = 'name='+ x + '&email=' + email;
. , (), , (), , - .
:
$(function() {
$("#button").click(callme);
function callme() {
$.ajax({
type: "POST",
url: "/temp/AjaxPostSend",
data: {name: $('#name').val(), email: $('#email').val()},
success: function(msg){
alert( "Data Saved: " + msg );
}
});
}
});
,
var msg = $.ajax({...}).responseText;
, Ajax . , callme() , Ajax. success.
: async: false, , , ;) . Ajax ( Sjax), .