$.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
});服务方式
@RequestMapping(method = RequestMethod.GET,
value = "/message" )
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public String message()
{
return "jasdknsd";
}如果我在服务方法中做错了什么,并且这两个方法都在同一个网络中,因此我没有使用回调,我得到的这个调用的响应是空的,请帮助我
发布于 2012-03-15 23:59:39
不支持到localhost的连接。
http://code.google.com/p/android/issues/detail?id=133
127.0.0.1是模拟系统自己的环回接口,而不是在主机开发计算机上运行的接口。
在安卓系统中,用户应该使用10.0.2.2,这是一个专门设置用来联系主机127.0.0.1的别名
发布于 2012-03-16 00:03:24
使用10.0.2.2而不是localhost:8080
https://stackoverflow.com/questions/9723450
复制相似问题