jquery - Ajax not sending to controller -


i trying use ajax update page:

@using (html.beginform())  {     @html.antiforgerytoken()      <div class="form-horizontal">          <hr />         @html.validationsummary(true, "", new { @class = "text-danger" })         <div class="form-group">              <div align ="center" class="col-md-12">                 @html.editorfor(model => model.youritem.comment, new { htmlattributes = new { @class = "form-control", placeholder ="add item", id="mango" } })                 @html.validationmessagefor(model => model.youritem.comment, "", new { @class = "text-danger" })             </div>         </div>          <div class="form-group">             <div align ="center" class="col-md-12">                 <button type="button" id="min_knapp" class="btn btn-default-shoppinglist">add </button>             </div>         </div>     </div> }  @if (model != null) {     @html.partial("~/views/shoppinglists/_create.cshtml", model.mylist) } <script>      $("#min_knapp").click(function() {         var v1 = jquery("#mango").val();         jquery.ajax({             url: '@url.action("create","shoppinglists")',             method: "post",             cache: false,             data: { mango: v1 }         }).done(function (d) {             jquery("#handleliste").text(d);         });     }) </script> 

my shoppinglistscontroller:

[httppost]         [validateantiforgerytoken]         public actionresult create(partialviewmodel d)         {             // add "current group" each new item , put in database             d.youritem.groupid = convert.toint32(request.cookies["selectboxvalue"].value);             db.shoppinglists.add(d.youritem);             db.savechanges();              pv.mylist = db.shoppinglists.tolist();              return partialview("_liste");         } 

when press button expecting data textfield sent controller , post result page, nothing happens. wrong?


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -