Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-28-2011, 09:36 AM   PM User | #1
smithysrat
New to the CF scene

 
Join Date: Jan 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
smithysrat is an unknown quantity at this point
AJAX behaving badly

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 );
http.send(null);
}

Thanks,
R
smithysrat is offline   Reply With Quote
Old 01-28-2011, 01:16 PM   PM User | #2
Spudhead
Senior Coder

 
Spudhead's Avatar
 
Join Date: Jun 2002
Location: London, UK
Posts: 1,856
Thanks: 8
Thanked 110 Times in 109 Posts
Spudhead is on a distinguished road
Where is function createRequestObject() defined?
Spudhead is offline   Reply With Quote
Old 01-28-2011, 10:39 PM   PM User | #3
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,469
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
try replacing your first real line with this:

Code:
var http =  !window.XMLHttpRequest ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest;
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Reply

Bookmarks

Tags
ajax java help

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:23 PM.


Advertisement
Log in to turn off these ads.