Solved

Jquery - differences between two error codes

Posted on 2014-04-01
5
462 Views
Last Modified: 2014-04-01
Hi E's,
Can you please tell me, what is the diference between this two jQuery "error:" codes:
error:function(jqXHR, textStatus, errorThrown) { alert("error"); }

Open in new window

and
error: function(){ alert("error");}

Open in new window

I try to understand the difference, because the first error not work in i.e.11, and functions are identical I can substitute one for the other.

The best regards, JC
0
Comment
Question by:Pedro Chagas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 39970608
The difference is that you are defining the 3 parameters that provides more error details. I am assuming it is an ajax call.

Please post the whole AJAX call code. the error and what version of Jquery you are using as well. Also make sure you are not having any non-visible character that may invalidate the first error method.
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 39970707
Hi,
This code not work in i.e. 11
$.ajax({
    method:"POST",
    url:"processa.php",
    data:{"nj":numero_jogo, "fase":'3'},
    success:function(data, textStatus, jqXHR){},
    error:function(jqXHR, textStatus, errorThrown) { coneccao('1'); },
    });

Open in new window

but this one work:
$(function(){
        $.ajax({
        type: "POST",
        url: "processa.php",
        data: {'varinha': '0'},
        success: function(dat){
                if(dat != ""){
                alert(dat);
                }
        },
        error: function(){ alert("erro");}
        
        });
});

Open in new window

The version of jQuery that I use is v1.5.2.
I know is old, but I begin the project with that version, and when I try to change to more recent version, lots of scripts not work.

~JC
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 39970711
What kind of information receive data, textStatus, jqXHR?

~JC
0
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 39970752
Certainly it is an old version and it is always a risk that it may not work at all in modern browsers. Try:
$.ajax({
    type: "POST",
    url: "processa.php",
    data: {"nj": numero_jogo, "fase":'3'},
    success: function(data){ alert('success'); },
    error: function(jqXHR, textStatus, errorThrown) { alert('error'); },
    }); 

Open in new window

If it does not work:
Q1. Was the faulty code working before? Which IE version?
Q2. If it works in IE version X. Does it work in IE 11 compatible mode? You could ask your users to use IE 11 compatible mode for the time being.
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 39970802
Thank you for your time and try to help.
I'll think seriously about changing the version of jquery. In the future I may have big problems if do not.

The best regards, JC
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sort Multi-dimensional array 6 45
Different Javascript on iPhone than Win 10 desktop? 7 55
Jquery syntax 12 30
Where does this error come from? 8 26
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question