Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Jquery - differences between two error codes

Posted on 2014-04-01
5
Medium Priority
?
480 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
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 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…
Suggested Courses

704 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