java - AngularJS $http.post method passing null arguments to JAX-RS API -
i'm trying pass arguments angularjs post method:
function create(email, password, phonenumber) { return $http.post('resources/users/register', {email: email, password: password, phonenumber: phonenumber}).then(handlesuccess, handleerror('error creating user')); }
to jax-rs method :
@post @produces(mediatype.application_json ) @path("/register") public response register(@formparam("email") string email, @formparam("password") string password, @formparam("phonenumber") string phonenumber) {
i have loggers before $http.post , on beggining of register method, when arguments on web side contains info, every argument on server null -> trying use curl method - fine!
anyone have idea?
try change json object :
{'email': email, 'password': password, 'phonenumber': phonenumber}
javascript var ---> string name values
json data written name/value pairs. name/value pair consists of field name (in double quotes), followed colon, followed value:
Comments
Post a Comment