Reputation: 159
$.getJSON("http://localhost:8080/v1/message",
function(data) {
console.log(data);
alert("message"+data);//this alert stmt is displayed it means that
the service call is getting executed
});
service method
@RequestMapping(method = RequestMethod.GET,
value = "/message" )
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public String message()
{
return "jasdknsd";
}
I am getting response of this call as null please help me out if I am doing something wrong in the service method and I have both of them in same network because of which I am not using callback
Upvotes: 1
Views: 693
Reputation: 4372
Connection to localhost is not supported.
http://code.google.com/p/android/issues/detail?id=133
127.0.0.1
is the emulated system's own loopback interface, not the one running on
your host development machine.
within the Android system, one should use 10.0.2.2
which is an alias specifically
setup to contact your host 127.0.0.1
Upvotes: 3