jquery ajax call to java restful web service always going to error function
Hi All,
I am using jquery ajax to call restful webservice which returns a String.
But it always goes to jquery error function when call that service.
Here is the calling code:
window.onerror=function(msg,url,line){
$('body').append(msg + ' at ' + url + ':' + line);
};
$.ajax({
url:"http://192.168.254.25:8080/WeightsAndMeasure/restful/DerivativeCodeServic/checkIP",
data:"derivativeCode="+$("#derivativeCode").val(),
type:"get",
dataType:"text",
crossDomain:true,
success: function (data) {
alert('success'+data.responseText);
},
error: function(jqXHR, textStatus, errorThrown) {
throw 'aj.ERROR! [' + jqXHR.status +' '+textStatus.error + errorThrown + ']';
},
complete: function (response) {
alert("inside success"+response.responseText);
}
});
};});
Alert shows like this:
uncaught exception: aj.ERROR! [0 undefined] at :0
Please help in solving this issue.
Thanks in advance.