asp.net mvc - Jquery form post Issues -


i using asp.net mvc , having issue posting form using jquery. not posting url telling to. if use firebug, shows post happening posting index of controller everytime. cannot figure out why. have verified url of action trying post can't figure out why posting index of controller....note: view in form found index view. posting it's own action rather 1 in url telling to. great. thanks!

here form

 <form  action='' id="descriptionform"> <%=html.hidden("claimnumber", viewdata["claimnumber"])%> <%=html.hidden("partnumber", viewdata["partnumber"])%> <%=html.hidden("qty", viewdata["qty"])%> <table>     <tr>         <td style="text-align: right">             category:         </td>         <td>             <%=html.dropdownlist("problemcategory", (ienumerable<selectlistitem>)viewdata["problemselect"], "-select-")%>         </td>     </tr>     <tr>         <td style="text-align: right">             details:         </td>         <td>             <select id="problemdetails">             </select>         </td>     </tr>     <tr>         <td style="text-align: right">             dealer notes:         </td>         <td>             <%=html.textarea("dealernotes", "", 3, 40, null)%>         </td>     </tr> </table> <div style="position: absolute; bottom: 8px; right: 8px">     <input type="button" id="itemdetailscancel" value="cancel" />     <input type="submit" id="itemdetailssubmit" value="save" /> </div> </form>  <a href='<%=resolveurl("~/warranty/warrantyclaims/completeaddlineitemtoclaim/") %>' id="completelineitemurl"></a> 

here javascript

   $("#descriptionform").submit(function () {     var completeurl = $("#completelineitemurl").attr('href');     var data = $(this).serialize();      $.post({         type:'post',         url: completeurl,         data: data,         success: function (result) {             alert("done");         }     });     return false }); 

and measure here controller action trying post to(though doesn't yet)

  [httppost]     public actionresult completeaddlineitemtoclaim(string claimnumber, string partnumber, string qty, string problemcategory, string problemdetails, string dealernotes)     {         var result = new { result = "done" };          return json(result, jsonrequestbehavior.allowget);     } 

update: updated javascript

$(function(){          $('#descriptionform').submit(function () {             var completeurl = $('#completelineitemurl').attr('href');             var data = $(this).serialize();              $.ajax({                 type: 'post',                 url: completeurl,                 data: data,                 success: function (result) {                     alert('done');                 }             });             return false;         });   }); 

is form loaded ajax call?

if need use live() function of jquery.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -