Solved

Jquery - differences between two error codes

Posted on 2014-04-01
5
450 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
  • 3
  • 2
5 Comments
 
LVL 35

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 35

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Animated .jpg? 13 61
wordpress display sub menu only when click 12 23
Change color of pagination for twbs-pagination 3 8
Python - desktop use 1 10
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now