PDA

View Full Version : php code not being called via ajax


snoodle
12-23-2007, 06:37 PM
I'm baffled. I don't know which code to post that might explain why I'm having this problem, so I'll hold off and describe the general issue and see if anyone has any ideas...

I have a page with 2 <table>'s that get populated by ajax'ing php code that retrieves the info from a database. The 1st time the site is run, everything works perfectly.

On the same screen are input fields. After data entry a submit button is pressed, which uses AJAX to call the php code to input the new data into the appropriate sql tables. This also works fine (if I examine the sql tabes via phpadmin, all data is there).

Right after the new info is submitted, the <table>s should be instantly updated (after ajax calls to repopulate the <table>s). Using error messages (alerts in javascript, and writes to a database error table when in php code), I can see that the calls are made in javascript, but the php code never seems to be reached.

If I do a page Refresh, the same problem occurs, however, if I close the web page, then reload it, the ajax calls the php code and the <table>s are updated just fine.

Without seeing the code, does anyone have any ideas what might be going on?

shyam
12-24-2007, 10:12 AM
Without seeing the code, does anyone have any ideas what might be going on?
not quite...

1andyw
12-24-2007, 01:55 PM
http://www.codingforums.com/showthread.php?t=118164&highlight=works

Perhaps this link covers your issues.

Andy

A1ien51
12-24-2007, 03:51 PM
Your request is cached. You need to use a post, change the order of the request to:

open
onreadystatechange
send

, and/or send this header xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");

Eric

snoodle
12-25-2007, 05:34 AM
THANK YOU!!!!!!!!!!!!!!!!!! I've run into the url cache thing before. I should have known. Thank you again.