i am trying to pass two values to php file via ajax
my code is like this
PHP :
<?php
$name="Name with spaces";
?>
JS :
var yourMessage = $("input#message").val();
$.ajax({
type: "POST",
url: "send_message.php",
data: "yourName="+ <?=$name?> +"&yourMessage="+ yourMessage,
success: function(html){........
its working fine but
i am getting two problems.
-
name is in php variable and it had spaces, it gives error of spaces but i need to have same name with spaces on send_message.php
-
yourMessage is getting value from
<textarea>and if there is any return keys i need also to pass on send_message.php.
Thanks
Replacing
with
might solve your problem.