AJAX request works on all browsers except Firefox

Asked

Viewed 192 times

3

I have tried to make an upload system with AJAX and works perfectly in Chrome, however it does not work in firefox. I used the function $.ajax() jquery. Have any suggestions of what might be?

I have a normal form that requires a file and AJAX makes a PDF Viewer appear, like:

$.ajax({
  url: 'url.php',
  method: 'POST',
  data: dados,
  success: function(data) {
    $("#mensagem").append(data);
}
})

And I do not understand why firefox does not work.

  • 1

    Go to Firebug and see if there’s any other error in javascript that might disturb this.

  • 1

    I tried firebug, but I still couldn’t find anything significant. Only a NS_ERROR_FAILUTE that is an AJAX error common in those who use Firefox and a _getLoginDataFromParent: A form origin is required which is possibly from a PDF Viewer that I am using.

  • 1

    You will see that the problem has nothing to do with ajax, but with the PDF (or its viewer). Try testing with other content and see if the problem remains.

  • 1

    @Bacco tb I think.

  • 1

    https://dxr.mozilla.org/mozilla-beta/source/toolkit/components/passwordmgr/LoginManagerContent.jsm line 294?

  • In all versions or only the one you have installed?

  • Read it here: https://stackoverflow.com/questions/9622901/how-to-upload-a-file-using-jquery-ajax-and-formdata/9622978#9622978. I think it might help.

  • It depends a lot on several factors, please update the question by adding more information like: Jquery version, The access domain is the same (CORS), browser version, Answer data, Answer encoding...

Show 3 more comments

1 answer

0

Use the following code, where I edited "method" for "type":

$.ajax({
        type: "POST",
        url: "url.php",
        data: dados,
        success: function(data){
                                $("#mensagem").append(data);  
                 }
});
  • In the documentation explains that type is just one alias for method. The only difference is that the method exists only in jQuery 1.9.0 up.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.