Friday, 15 March 2013

javascript - JS Prompt to PHP Variable -



javascript - JS Prompt to PHP Variable -

is possible? or need ajax js first?

<?php echo'< script type="text/javascript">var eadd=prompt("please come in email address");< /script>'; $eadd = $_post['eadd']; ?>

and how can ajax?

its not possible. should utilize ajax. jquery used in next example:

<script> var eadd=prompt("please come in email address"); $.ajax( { type: "post", url: "/sample.php", data: eadd, success: function(data, textstatus, jqxhr) { console.log(data); } }); </script>

in php file

<?php echo $_post['data']; ?>

javascript php prompt

No comments:

Post a Comment