javascript - Posting Form via Jquery not passing data -


i using following code post form not getting form data passed code behind?

 <script type="text/javascript">         $(document).ready(function () {              $("#submit").live("click", function () {                 var formdata = $("#createorder").serialize();                 $.post("/orders/saveextra", formdata, function (result) {                                         if (result.created) {                         alert("saved successfully!");                     } else {                         alert("error!");                     }                 });                             });         });     </script>      <input id='submit' type='submit' value='save extra' style="height: 30px; width: 130px; margin-top:8px;margin-right: 15px; float:right " />     <form id="createorder" method="post" action="/orders/create" enctype="application/x-www-form-urlencoded" >        ...  </form> 

i have main form calls different method save one, need 2 submits doesn't seem posting data form?

in post's first parameter, need specify the full path of service. example:

$.post("http://localhost:8080/orders/saveextra", formdata, function(result){...} 

on side note, if jquery version higher 1.7 recommended change .live() .on(), since .live() deprecated.


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -