0

I'm having trouble making an ajax request wait for php script to load, the script works in chrome but not IE in both instances.

On a button press the script should fire a php script wait for it to complete then display an alert to say it has complete but in IE the alert box displays too quickly and the script never runs. It does work in chrome as expected.

This is attempt 1

 function reloadCalls(){
  $('#reload').prop('disabled', true);
  $('.ajax-progress-throbber').show();
  $.ajax({          
    url: '/kpi/technet_proj/cron/proj_cron.php',
     success: function(r){
       alert('Calls Loaded');       
       location.reload();
     },
     error: function(r){
       alert('Calls not loaded');
     }
  });
 }

This is attempt 2

 function reloadCalls(){
  $('#reload').prop('disabled', true);
  $('.ajax-progress-throbber').show();
  $.ajax({          
    url: '/kpi/technet_proj/cron/proj_cron.php',
     success: function(){
       alerts();
     },
     error: function(){
       alert('Calls not loaded');
     }
  });
}

function alerts(){
  alert('Calls Loaded');
  location.reload();
}

I have also tried adding async:false that does kind of work but it doesn't display the throbber and jams the browser until the script has complete.

Any help would be appreciated

3
  • Which versions of jQuery & IE are you using? Commented Aug 7, 2013 at 9:36
  • maybe IE doesnt like the missing ; after the $.ajax() or the unneccessary ; after the reloadCalls() {} function Commented Aug 7, 2013 at 9:37
  • edited as above and still have the same issue, I'm using IE9 and jQuery 1.7 there are no error messages in the IE console. Commented Aug 7, 2013 at 9:47

1 Answer 1

1

I worked it out the answer is to add cache: false to the ajax request.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.