Friday, 6 September 2013

Get json from Web Service

Get json from Web Service

I have a REST Web Service on Spring and now i want to split it into Server
and Client.
When everything was as one application it worked fine, but now i'm facing
some issues.
I don't receive data from server, though i get 200 OK from it.
Server-side (http://localhost:8085)
@Controller
@RequestMapping(value = "/user")
public class RestController {
@RequestMapping(value = "/{userLogin}", method = RequestMethod.GET)
@ResponseBody
public Wrapper edit(@PathVariable String userLogin) {
return wrapper.wrap(userService.findByLogin(userLogin));
}
}
Client-side (http://localhost:8089)
function editUser(login) {
$.ajax({
type: "GET",
url: "http://localhost:8085/user/" + login,
async: false,
success: function (resp) {
alert("asdasdasdasdasdas");
}
});
}
When i manually access link http://localhost:8085/user/user1 i see such
line in browser
{"id":1,"login":"user1","password":"user1","passValid":"user1","email":"user1@user1.nix","firstname":"user1","lastname":"user1","birthday":"1940-08-10","roleid":"User"}
Could you please tell me what is wrong with my app?

No comments:

Post a Comment