PDA

View Full Version : Javascript Insert



stephenalistoun
03-11-2009, 12:23 PM
Hi all,

How do I insert the following data into a php file using AJAX


function AddCity()
{
itemID = document.form.ItemID.value;
countryID = document.form.refCountryID.value;
regionID = document.form.refRegionID.value;
cityID = document.form.refCityID.value;

var url = 'ajaxFunctions.php?itemID='+itemID+'&countryID='+countryID+'&regionID='+regionID+'&cityID='+cityID;

xmlHttp = new GetXmlHttpObject();

xmlHttp.open('GET', url , true);

xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{

}
}
}

xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

xmlHttp.send(null);
}




function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject('Msxml2.XMLHTTP');
}
catch (e)
{
xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');
}
}
return xmlHttp;
}