Search code examples
jqueryajaxinternet-explorer

jQuery is not filtering/selecting on IE after ajax call


I have the following code that works on Firefox and Chrome

$("#adicionarItem").click(function(){
    $.ajax({
        type: 'GET',
        url: $("#formAdicionaItem").attr("action"),
        data: $("#formAdicionaItem").serialize(),
        success: function(response){
            alert($("div#errors", response).size());
        }
    });
});

In IE the alert always returns zero. In Firefox/Chrome it returns 1 which is the expected value. Does anyone know if this is a bug or if I am doing something wrong?


Solution

  • This would happen if the response is somewhat malformed.
    Make sure that all of the tags in the response are correctly closed.