Solved

Jquery - differences between two error codes

Posted on 2014-04-01
5
466 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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

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…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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)
Suggested Courses
Course of the Month10 days, 20 hours left to enroll

628 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