I am trying to send ajax call from domain: cdn.foo.com to a service on www.foo.com.
On www.foo.com there is a jsonService.
when I send this :
$.ajax({
url: json_url + "jsonService/AnyService/someMethod",
type: "POST",
dataType: "json",
contentType: "json"
//do something
});
I get request but no response.
And when trying to send this :
$.ajax({
url: json_url + "jsonService/AnyService/someMethod",
type: "POST",
dataType: "jsonp",
contentType: "json"
//do something
});
I get an error: 405 Method Not Allowed
I am using tomcat 7.0.12.
what should I do so the request will get to the service?
use jquery's getJSON method:
var url = http://www.foo.com/jsonService/AnyService/someMethod?callback=?
$.getJSON(url, function() {...});
see the below for a more indepth explanation of jsonp
http://www.devproconnections.com/article/aspnet2/ajax-cross-domain-142169
solved it by $.post(url , data);