How to insert a "Finished message" in an AJAX script
When the loop in this demo,
http://www.toddcary.com/test/ajax3/index.php , finishes, I would like to display "Finished". Since I am such a newbie, I am not sure how/where to put that code in the following:
- $(document).ready(function()
- {
- // Hide the results
- $( "#send_results" ).hide();
- //kick off the process
- $('#startButton').click(function(event) {
- $.ajax({
- url: 'send_email.php',
- success: function(data) {}
- });
- //start polling
- (function poll(){
- setTimeout(function(){
- $.ajax({
- url: "get_progress.php",
- success: function(data){
- // Show the results
- $( "#send_results" ).show();
- //Update the progress
- if (data.length > 0) {
- $("#send_results").html(data);
- } else {
- $("#send_results").html("");
- }
- //Setup the next poll recursively
- poll();
- },
- dataType: "text"
- });
- }, 3000);
- })(); // Polling
- }); //Start button pressed
- });
- </script>
I was able to stumble my way to get the above...now I am stumpted.
Any suggestions are welcomed...
Todd