ok so I am using to dynamically update a section of my website and what I want it to do is take the input from the user (which will be an email address) send it to my php file so I can run an SQL query to make sure it hasn't been submitted already then if it hasn't been it updates my database and returns a line saying "Thank you for subscribing"
I have the php file done and everything with querying the database and/or updating it as needed.
what I don't know how to do is send the user input through AJAX to my php file.
I am taking for granted that ___ xmlhttp.send('sub=$_POST['email']'); ___ is wrong since it didn't work lol.
the last part of my AJAX code looks like this:
if (xmlhttp.readyState==4 &&
xmlhttp.status==200)
{
document.getElementById("email")
.innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","sub_thank.php"
,true);
xmlhttp.send('sub=$_POST['email']');
}
I split the code a little so yahoo wouldn't cut it off >.> I hate how it does that.
I have the php file done and everything with querying the database and/or updating it as needed.
what I don't know how to do is send the user input through AJAX to my php file.
I am taking for granted that ___ xmlhttp.send('sub=$_POST['email']'); ___ is wrong since it didn't work lol.
the last part of my AJAX code looks like this:
if (xmlhttp.readyState==4 &&
xmlhttp.status==200)
{
document.getElementById("email")
.innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","sub_thank.php"
,true);
xmlhttp.send('sub=$_POST['email']');
}
I split the code a little so yahoo wouldn't cut it off >.> I hate how it does that.