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

Best Ajax Tutorial Simple and Easy to understand

Ajax  Code to Get You Started

Here are the 2 different codes that I use in the video to help you get started.

Create a file and call it index.php.

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. 🙂
<title>Ajax Example</title>
 <input type="email" id="email" size="50" placeholder="Email Address">
 <button type="button" id="subsub" onclick="ajax_post();">Subscribe</button>
<div id="status"></div>
function ajax_post(){
 var hr = new XMLHttpRequest();
 var url = "processor.php";
 var emm = document.getElementById("email").value;
 var vars = "email="+emm;
 hr.open("POST", url, true);
 hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
 hr.onreadystatechange = function() {
 if(hr.readyState == 4 && hr.status == 200) {
 var return_data = hr.responseText;
 document.getElementById("status").innerHTML = return_data;
 hr.send(vars); // After Check Steps are done execute the request
 document.getElementById("status").innerHTML = "processing...";

Create another file and call it processor.php. Here is the code for that file.

echo 'the email is'. $_POST['email'];
}; ?>
Best Ajax Tutorial Simple and Easy to understand was last modified: June 11th, 2017 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


Cool People Share:
best-ajax-tutorial simple and easy to understand

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.