I have this code:
var data_string = $('form#frm').serialize();
$.ajax({
type: "POST",
url: "/send.php",
data: data_string,
success: function(data) {
alert(data);
And in the php file:
$to = mysql_real_escape_string($_POST['email']);
$name = mysql_real_escape_string($_POST['name']);
$msg = mysql_real_escape_string($_POST['msg']);
echo $name;
The above warning in ajax code SHOULD notify the published variable $name. However, a warning message appears, but it is empty.
I think this is due to the serialization part.
echoing 1 or 0 from php is working fine, and 1 or 0 is displayed in the warning field.
Any ideas on something wrong?
thank
EDIT:
It was found that when warning serialized data:
alert (data_string);
I get "undefined" ...
And here is the form:
<form name='frm' id='frm' action='send.php' method='post' onsubmit='tip_func(); return false;'>
<input type='text' name='name' id='name'>
tip_func () is a function in which all of the above ajax values ...
user188962
source
share