function update(value1)
{
doAjax("behind_scan.php" , "id="+value1);


}


function doAjax(url , str )
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
url=url+"?"+str;
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
{
//document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
//alert(xmlhttp.responseText)
document.forms.myform.scanner.value = "";
document.forms.myform.scanner.focus();

}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}

This pages calls a function on a separate php page to run 2 mySQL queries, the value must be put in the text 3 times in quick succession before the database is altered.

If you think this code is not the problem could you please say it. Ive tried all the other functions and they seem to be fine, AJAX is my weakness but I need it for the main functionality of my website. I NEED THIS TO WORK!!!!!!! :) :)

the value does not get passed all of the time.... what could cause this ???
:( :( :(

How are you calling function update?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.