1 Star2 Stars3 Stars4 Stars5 Stars (13 votes, average: 5.00 out of 5)

jQuery Ajax Form Submit With PHP Processing

Scripts for jQuery Tutorial

Create a file and call it index.php. Put the following code into the file.

<!DOCTYPE html>
<html>
<head>
<title>Submit Form Using AJAX and jQuery</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
</head>
<body>
<input id="name" type="text" placeholder="Your Name">
<input id="email" type="text" placeholder="email">
<input id="submit" type="button" value="Submit">
<div id="display"></div><script>
$(document).ready(function(){
$("#submit").click(function(){
var name = $("#name").val();
var email = $("#email").val();
var dataString = 'name1='+ name + '&email1='+ email;
if(name==''||email=='')
{
$("#display").html("Please Fill All Fields");
}
else
{
$.ajax({
type: "POST",
url: "processor.php",
data: dataString,
cache: false,
success: function(result){
$("#display").html(result);
}
});
}
return false;
});
});
</script>
</body>
</html>

Now create a file and call it processor.php and put the following code into the file.

Tip: Click on images to make them larger. If you find anything wrong on this page or need further assistance please comment below or contact me. 🙂
<?php $name=$_POST['name1']; $email=$_POST['email1']; echo "Form Submitted Succesfully"; echo '<br/>'; echo $name; echo '<br/>'; echo $email; ?>
jQuery Ajax Form Submit With PHP Processing was last modified: November 16th, 2018 by Maximus Mccullough

Subscribe To My YouTube Channel:

Please like, share and subscribe.

Advanced Programming Made Easy

I hope you enjoyed the article. If I was able to help you please consider a tip for the content.

One Time Tip

more tips

Reoccuring Tips

Tips

Cool People Share:
jQuery Ajax Form Submit With PHP Processing

Pages:Previous 1 2

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.