afridy — 2012-02-16T02:25:11-05:00 — #1
in below code the refresh(); , an ajax function does not invoke
but this works
Now it works . Strange trick is it :rofl:
So whats the problem really?
paul_wilkins — 2012-02-16T02:55:32-05:00 — #2
Is there a way for us to experience (and thus troubleshoot) the same problem?
Without knowing more about your particular situation, the standard technique is to pass a callback to the ajax function, so that the data on a successful request can be passed to the callback.
afridy — 2012-02-16T03:18:05-05:00 — #3
its not possible to generate the problem simply. coz it a whole lot of coding.
in summary i can tell like this
- form.php have a div with the id of 'res'. also have a text box and a button. now user enters the employee number and click the button.
so add_emp() will be executed in the following order: button click > ajax call > php ad record
- now reloading all the employee data in to the res div using refresh() : ajax call > php load data from table.
problem is , this loading does not occur if i use only 1 refresh().
afridy — 2012-02-16T03:19:44-05:00 — #4
oops, i fogot,
if i put an alert(); in the refresh ajax function as follows even works!!
// code for IE7+, Firefox, Chrome, Opera, Safari
// code for IE6, IE5
paul_wilkins — 2012-02-16T03:20:21-05:00 — #5
The load part shouldn't occur after the ajax call, because data is still being transferred.
Instead, the load part needs to occur only when the the success event occurs for the ajax command.
afridy — 2012-02-16T03:35:32-05:00 — #6
Thanks paul for the valuable info.
so i think i could use the readyState==4 && xmlhttp.status==200 in the first ajax file to handle this situation ...
paul_wilkins — 2012-02-16T03:38:12-05:00 — #7
There's a book called Bulletproof Ajax that gives all the details on how to do that well.
They provide code and examples from the book on their website too, from which much learning can be done.
afridy — 2012-02-16T03:54:15-05:00 — #8
sure,ill consider about this book . thanks a lot.
system — 2014-10-07T21:57:02-04:00 — #9
This topic is now closed. New replies are no longer allowed.