Reputation: 55
Scenario I have an export.php file that remotely exports a 1000 images. It's broken down to export 20 images then reload and do the next 20 until all images have been exported. This works fine the thing is I wanted to make it look cleaner and have it running in the background.
So as I have jQuery on my index.php page I done a simple ajax call and HOPED the response would be "20" then "40" and so on, showing how many images have been exported so far. If only it would of been that easy.
The problem is that my front page gets updated with the first call but I need it to carry on running and updating until I say so. No doubt I am missing something simple, it's always the way.
Any help would be appreciated and I hope that makes sense.
ajax call:
$.ajax({
url: "export_images.php",
cache: false,
success: function(data){
$("#export_images_result").text(data);
}
});
Upvotes: 0
Views: 2223
Reputation: 15931
You probably want to use a jquery timer to call the page repeatedly so it can process all of the images.
Upvotes: 0
Reputation: 8700
You could just call the php file every 20 images using separate ajax calls & pagination. Instead of having the php file do it. I would be happy to give an example if you post the php, and the rest of the javascript.
I would recommend not using post for such a large upload, but maybe public ftp or something. POST is so unreliable, and doesn't give progress, etc. FTP is far from perfect, but a better option (imo) for this type of system. Though I guess you don't get to choose sometimes.
Upvotes: 1