我遇到了无法解决的 ajax 问题,需要一些帮助...我将 Spring 用于我的 REST api,而我的 ajax 调用似乎不起作用...我已经搜索了论坛并且无法寻找答案:
我的java Spring api如下:
@Controller
@RequestMapping("api")
public class RecentRestController {
    RecentService recentService;
    @Autowired
    public void PersonRestController(RecentService recentService) {
        this.recentService = recentService;
    }
    /**
     * Add recent lake, then get recently viewed lakes and users ordered by timestamp
     * @param handle
     * @return
     */
    @RequestMapping(value = "recent/weather/{auser}/{temp}/{windspeed}/{winddeg}/{laketag}", method = RequestMethod.GET)
    @ResponseBody
    public RecentlyViewedList getRecentlyViewedLakes(@PathVariable String auser, @PathVariable Integer temp, 
            @PathVariable Integer windspeed, @PathVariable Integer winddeg, @PathVariable String laketag) {
        RecentlyViewedList rvl = recentService.getRecentlyViewedWeather(auser, temp, windspeed, winddeg, laketag);
        return rvl;
    }
当我使用 ajax 从 ajax 调用这个 Java REST 时,它似乎不起作用。我的 ajax 调用在 html/php 中如下所示:
new $Ajax.Request('http://localhost:8080/server/api/weahter/lake/' + agruments.auser + '/' + arguments.windspeed +'/' + arguments.winddeg + '/' + arguments.laketag, {
      type : "GET",
       //:url : recenturl,
       //cache : false,
       async : false,
       crossDomain: true,
       dataType : 'jsonp',
       //data: arguments,
       success : function(recent) {
           alert("SUCESS");
            var i=0;
            var lakecount = recent.lake.length;
            var usercount = recent.user.length;
            alert("lakecount:" + lakecount);
            alert("usercount:" + usercount);
       },
       error : function(XMLHttpRequest, textStatus, errorThrown) {
          alert("An error has occurred making the request: " + errorThrown);
       }, 
    });
它似乎永远不会起作用。它永远不会正确调用我的 REST api。我做错了什么?
我调用 REST 服务的方式有问题..
任何帮助是极大的赞赏..
提前致谢。