php - How to get more than 1 ajax call response in different intervals? -
as i'm doing ajax call need show in front end what's running in end.
for example, i'm uploading file. @ time have following steps complete.
- inserting file data db
- moving of files folder, based on response step 1
- finally updating db
through single ajax
- while step 1 running need show : inserting files db...
- in step 2: moving files folder...
- in step 3: updating table...
i know how 3 responses @ time
json_array('res1' => '', 'res2' => '', 'res3' => '')
but need same responses 3 intervals. below code understand
function file_sampe_upload(){ //code insert ....... echo json_array('status' => 1, 'res1' => 'files inserted successfully'); //code moving files specific folder ...... echo json_array('status' => 1, 'res2' => 'files moved successfully'); //code updating files ...... echo json_array('status' => 1, 'res3' => 'files updated successfully'); exit;}
is there possibility this? advise helpful.
update:-
is concept outputbuffering full, issue?
you need perform 3 ajax requests this. this:
function file_sampe_insert(){ echo json_array('status' => 1, 'res1' => 'files inserted successfully'); exit; } function file_sampe_move(){ echo json_array('status' => 1, 'res2' => 'files moved successfully'); exit; } function file_sampe_upload(){ echo json_array('status' => 1, 'res3' => 'files updated successfully'); exit; } 1. ajax request call insert 2. ajax request call move 3. ajax request call upload
Comments
Post a Comment