ok so i am an avid php developer and i am starting to get into ajax so i can keep file sizes and code down to a minimum.
i am looking in the w3schools ajax examples but i am a little lost at how to send through a variable to the page i am using to process.
what i would like to do is send through an id that is being recalled from the database to tell it what to save over.
any help would be very helpful. thanks in advance
ajax
function action()
{
var xmlhttp;
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
{
document.myForm.time.value=xmlhttp.responseText;
}
}
xmlhttp.open("POST","action.php",true);
xmlhttp.send(null);
}
html form
<form action="#" method="post">
<button name="save" type="submit" value="Save" onclick="action();">Save</button>
<input type="text" name="address" />
</form>