I'm using JQuery ajax post with JSONP as datatype to resolve the problem of CrossDomain
this is my code implementation :
$.ajax({
statusCode: {
200: function() {
alert("page found");
},
302: function() {
alert("page redirect");
}
},
url: "http://exemple.com/j_spring_security_check",
type: "post",
dataType: 'jsonp',
jsonp: false,
jsonpCallback: 'localJsonpCallback',
contentType: 'application/json; charset=utf-8',
data: {ajax: true, username: 'user1', password: 'pass'},
success: function(){
alert("success");
},
error:function(jqxhr, textStatus, error){
alert("textStatus : " + textStatus + "\n error" + error);
}
});
function localJsonpCallback(data) {
alert("localJsonpCallback : " + data);
}
The problem is that I'm getting this message's error :
errorParsing , localJsonpCallback callback was not called.
I know why I'm getting this kind of message, because the client was attending a format like this :
localJsonpCallback({"success":1});
but I'm getting a result like that : {"success":1}
The problem is the callback method is not implemented in server because the guys know how to override this method with spring security. That's why it isn't called. And I don't have access to server.
Is there any way to get JSONP response without the implementation of callback function in the server ??
PS: I have to use JSONP to avoid this like error access-control-allow-origin not allowed