users@jersey.java.net

[Jersey] POSTing to Jersey using JQuery

From: Aidan C <aidanchurch_at_gmail.com>
Date: Mon, 31 Oct 2011 10:15:47 +0000

I'm attempting to POST data Jersey using the following..


the POST being made

    var details = {'username': username, 'password': password};
$.POST('login', details,function(result){
console.log(result);
},"json");

The receiving method

    @POST
     public Viewable HeyStaksLogin(LoginInfo loginI){
   String uname = loginI.username;
   String pword = loginI.password;
   System.out.println("username = ");
     }

The loginInfo class

    @XmlRootElement
    public class LoginInfo {
    public String username;
    public String password;
    }

however, I'm getting a TypeError saying undefined method back. Why is this
happening? How can I POST my data using JQuery?