I have a jQuery web app frontend that I would like to make GET/POST ajax calls to a Java backend that is running on Spring MVC.
Here is the GET request I want to make:
http://www.myapp.com/backend/doSomething?a=1&b=2
On the server-side, here is my BackendController object:
@RequestMapping(value = "/backend/doSomething", method = RequestMethod.GET)
public ModelAndView handleDoSomething(@RequestParam("a") String a,
    @RequestParam("b") String b) {
    ModelAndView mav = new ModelAndView();
    mav.setViewName("backend/SomeView");
    // process the request...
    return mav;
}
So here's the jQuery I have attempted so far:
$.get({
    url: "/backend/doSomething?a=???&b=???",
    success: function(data) {
    }
    ???
});
I've read the jQuery $.get page and I'm still confused about several things:
- What's the proper way of appending query string parameters into the urlforGETs?
- What's the proper way of adding form data into POSTs?
- I see that the successfunction takes three params:data,textStatus, andjqXHR, but many examples I see only list thedataportion - when do you pass it justdataand when do you pass it all three?
- What's the difference between the get'sdataproperty and itssuccess: function (data) { ... }argument?
- Is there any special configuration I need to do in my Spring backend so that jQuery can connect to it, or does jQuery not care about the backend at all?
I've tried looking these up but can't seem to get clear definitions for these items. Thanks in advance.
 
     
    