Jump to content

jQuery update textbox with progress of php function


datflo

Recommended Posts

Hi,

I've seen this done, and I thought it would be simple now that I am starting to understand ajax but I can't figure it out.

 

I am using jQuery ajax via wordpress.  I can click a button,  call a php function and use the value returned from php to populate the textbox.

 

Ok, great!

 

but I want to run a rather lengthy procedure, and while it's running I would like it to record it's status in a multi-line text box as sort of a debugger ( and to pass the time while waiting )

 

How can I accomplish this?  :) 

 

I've googled but I must not be using the correct words to search.

Link to comment
Share on other sites

but I want to run a rather lengthy procedure, and while it's running I would like it to record it's status in a multi-line text box as sort of a debugger ( and to pass the time while waiting )

 

How can I accomplish this?  :)

 

I also don't know how to ask google about this task :)

 

But I can direct you, I give you an algorithm.

1. You need daemon at your server. It could be PHP daemon. 

2. This daemon must receive your request to start that lengthy procedure and start it.

3. Daemon answers to browser that it has started your task.

4. Your JS script will periodically ask (via AJAX) that daemon about the state of the task.

5. While in process it returns one state, when finished it returns another state.

 

You may use ajax or WebSocket to connect JS script and server. The second one, I think, is preferrable for this task, because server can send to the browser any information without additional requests.

Edited by SergeiSS
Link to comment
Share on other sites

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.