javascript post to php

Solutions on MaxInterview for javascript post to php by the best coders in the world

showing results for - "javascript post to php"
Abril
09 Oct 2016
1    <form method="post" name="form" enctype="multipart/form-data">
2    <input type="text" name="name" id="name" placeholder="Name" required/>
3    <input type="email" name="email" id="email" placeholder="Email" required/>
4    <input type="password" name="pass" id="pass" placeholder="Password" required/>
5    <input type="submit" name="submit" value="Send" onclick="myFunction()"/>
6    </form>
7    
8  <script>
9    function myFunction() {
10    var name = document.getElementById("name").value;
11    var email = document.getElementById("email").value;
12    var password = document.getElementById("password").value;
13    $.ajax({
14            type : "POST",  //type of method
15            url  : "profile.php",  //your page
16            data : { name : name, email : email, password : password },// passing the values
17            success: function(res){  
18                                    //do what you want here...
19                    }
20        });
21    }
22    </script>