jaymc Posted June 10, 2008 Share Posted June 10, 2008 I have an ajax function which works like this open_url('page_to_sript', 'div_id_to_send_value_result_to'); Works fine, however, I have this function LINE 1: open_url('page.php', 'populate'); LINE 2: document.getElementById('div_row').innerHTML = '<textarea id="populate"></textarea>'; Again, this works. However, if the ajax reuqest takes 3 seconds to get the data, that textarea remains visible and blank for 3 seconds What can I do to say only process LINE 2 after open_url function has fully completed. I dont really want to add anything into open_url function, if possible Quote Link to comment https://forums.phpfreaks.com/topic/109551-solved-check-previous-function/ Share on other sites More sharing options...
kbh43dz_u Posted June 10, 2008 Share Posted June 10, 2008 change line1 and line2? Quote Link to comment https://forums.phpfreaks.com/topic/109551-solved-check-previous-function/#findComment-562014 Share on other sites More sharing options...
hansford Posted June 10, 2008 Share Posted June 10, 2008 If possible. this probably shouldn't be written until sessionstate==4 document.getElementById('div_row').innerHTML = '<textarea id="populate"></textarea>'; Quote Link to comment https://forums.phpfreaks.com/topic/109551-solved-check-previous-function/#findComment-562053 Share on other sites More sharing options...
jaymc Posted June 10, 2008 Author Share Posted June 10, 2008 change line1 and line2? Thats the whole point, it will just move onto the next function before waiting until the previous has finished execution If possible. this probably shouldn't be written until sessionstate==4 document.getElementById('div_row').innerHTML = '<textarea id="populate"></textarea>'; I really need a way to do this outside of my open_url function, as I use this so many times and dont really want go pile it up with code instances which apply for one bespoke feature of the site I need it outside of the function as demonstrated in my first post, if its at all possible? Quote Link to comment https://forums.phpfreaks.com/topic/109551-solved-check-previous-function/#findComment-562160 Share on other sites More sharing options...
hansford Posted June 10, 2008 Share Posted June 10, 2008 put the call to the second function in the first function When sessionstate=4 then call that function Quote Link to comment https://forums.phpfreaks.com/topic/109551-solved-check-previous-function/#findComment-562183 Share on other sites More sharing options...
jaymc Posted June 10, 2008 Author Share Posted June 10, 2008 I cant put anything bespoke to one function I need in the ajax function as this is a globally used function I need it to work as ive explained above, otherwise I am going to end up with x amount of statements in that function Can this be done in the way Ive explained above? Quote Link to comment https://forums.phpfreaks.com/topic/109551-solved-check-previous-function/#findComment-562264 Share on other sites More sharing options...
jaymc Posted June 10, 2008 Author Share Posted June 10, 2008 Edit I know why its not working In essance I am trying to alert() the RETURN before the ajax function has RETURNED anything due to processing time Quote Link to comment https://forums.phpfreaks.com/topic/109551-solved-check-previous-function/#findComment-562287 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.