开发者

jquery post method doesn't work with jax-rs web service

When I send this request using jquery:

<form id="myForm" action="http://myIp/../cat/create" method="post">
<fieldset>
<legend>jQuery.post Form Submit</legend>
    Cat Id  : <INPUT type="text" name="catId">
    Cat Name: <INPUT type="text" name="catName">
    <input type="submit" value="Submit" />
</fieldset>
</form>

The script:

 $(document).ready(function() { 
    $('#myForm').ajaxForm(function() { 
        alert("Thank you for your comment!"); 
    }); 
}); 

The JAX-RS(REST) cannot identify the correct method to call and print the following message: INFO: The system cannot find any method in the "My Class" class that supports OPTIONS. Verify that a method exists.

Hence when I do the same without using 开发者_JAVA技巧jquery but with just plain HTML everything is fine:

<FORM action="http://myaddress/../car/create" method="post">
<P>
    Car Id  : <INPUT type="text" name="carId">
    Car Name: <INPUT type="text" name="carName"><
    <INPUT type="submit" value="Send">
</P>
</FORM>

Can anybody tell me what I'm doing wrong with jquery?


I suggest putting HTTP Proxy (you can use Fiddler2) and see what is the difference between the requests. The error states that your class doesn't support OPTIONS. In Fiddler you can see if OPTIONS is really sent instead of POST.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜