JS Prompt to PHP Variable [closed]
Is this possible? Or do I really need to AJAX JS first? <?php echo'< script type="text/javascript">var eadd=prompt("Please enter your email address");< /script>'; $eadd = $_POST['eadd']; ?> and how can I do that with AJAX? divakar Its not possible. You should use ajax. jQuery was used in the following example: <script> var eadd=prompt("Please enter your 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']; ?> meda Ajax (using jQuery ) <script type="text