java web service cannot capture post parameter from jquery post -



java web service cannot capture post parameter from jquery post -

client:

var info = "username=david"; $.post("/s/test", data, function(result) { alert(result); });

server:

@post @path("/test") @produces(mediatype.text_plain) public string test(@formparam("username") string username) { homecoming "your username " + username; }

the username null $formparam.

however, if post form:

<form method="post" action="/s/test"> <input type="text" name="username" value="david" /> <button type="submit">submit</button> </form>

the value can captured correct.

really don't know why.

new findings: happen jquery 2.1, 1.6 ok.

newer findings: utilize gf 3.1.2.2 solve issue well, however, gf 4 has issue.

java jquery ajax web-services

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -