Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/109551-solved-check-previous-function/
Share on other sites

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?

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.