View Full Version : AJAX behaving badly

01-28-2011, 10:36 AM
Hi, I hope someone can help!

I have a function which calls a PHP script to insert/update records in a SQL Server DB. The same script needs to be called several times but it only seems to work the first time it is called otherwise I have to close and reopen the browser which defeats the object of the application...what am I doing wrong?

The function is :

function insertRecord(qid, qnum, saleamt,thresh,apis1,apis2, randomnumber)

// var http = "";
var http = new createRequestObject();
http.open( 'get', 'insert.php?qid=' + qid + '&qnum='+ qnum +'&saleamt='+ saleamt +'&thresh='+ thresh +'&apis1='+ apis1 +'&apis2=' + apis2 +'&instype=MASTER', false );


01-28-2011, 02:16 PM
Where is function createRequestObject() defined?

rnd me
01-28-2011, 11:39 PM
try replacing your first real line with this:

var http = !window.XMLHttpRequest ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest;