Created
January 3, 2019 20:23
-
-
Save tieutantan/187364b1aba5dfac8e2d5d634828b3ea to your computer and use it in GitHub Desktop.
Use jQuery Ajax with PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<script> | |
$.ajax({ | |
url:"info.php", | |
type:'POST', | |
data:{name:your_name,age:your_age}, | |
dataType:"html", | |
success:function(res) { | |
console.log(res); | |
} | |
error:function(error) { | |
console.log(error); | |
} | |
}) | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$name = $_POST['name']; | |
$age = $_POST['age']; | |
echo "Success"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment