Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

139
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda