Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
Only IE 11 losing focus on ajax call sometimes ASP.NET MVC4

I am using a boostrap dialog box to pull in a list with a quantity. After I submit my form, and open the dialog box to check to see if the quantity has updated, it seems to be stale data. I have a call with ajax to the controller and then back to the database to pull in updated info. But when I set a breakpoint in the controller (on server side) it never hits. IT ONLY kicks out of the issue when I set a breakpoint to the function calling ajax within developer tools and debugger. I don't see any console errors either.

I don't have an issue with Firefox, just IE11.. here is the code:

<script type="text/javascript">
    function LocationModal() {

        $("#GetLocBtn").attr("disabled", "disabled");
        var partNumber = $("#PartNum").val();
        var Condition = 'Z';
        var urlQry;
        var receiveIsChecked = document.getElementById('Receive').checked;

        var src = 'removed for security';
        $.ajax({
            type: "GET",
            url: src,
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            data: { partNumber: partNumber, CCODE: Condition },
            beforeSend: function () {
            },
            success: function (data) {                     
              $("#LocationModalContainer").html(data.LocationModal);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
            }
        });
    };
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The problem is indeed that IE caches the results of Ajax calls. You can prevent that behavior either by adding cache: false to every call, like you've discovered, or setting it globally via ajaxSetup before you make any calls.

$.ajaxSetup({
    cache: false
});

The use of ajaxSetup is discouraged in the jQuery documentation, but might be a good solution for you if you don't use any plugins that might rely on the normal behavior and want to quickly make sure none of your own ajax calls is cached.

Personally, I have my doubts about how real the interference risk mentioned in the documentation is when it comes to the cache setting, since basically you just make IE behave like other browsers.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!