jquery - Internal server error 500 while ajax call -
I'm trying to call this method:
// POST: / Producer / Delete / 5 [HTTP Post, ActionName ("Delete")] Public Action Result Deleted Confirmation (Int ID) {Producer Producer = Unitofwork. Productive Repository. Get BIID; UnitOfWork.manufacturerRepository.Delete (creator); UnitOfWork.Save (); Return Jason (new {ok = true, newurl = Url.Action ("index", "creator")}); }
with this Ajax:
$ Type: "Post", contentType: "application / json; charset = utf-8", header: {'Ajax ({url: "/ creator / delete" "+ $ (' # Id '). Val () RequestVerificationToken ':' @TokenHeaderValue () '}, data: {id: $ (' # id ') .val ()}, error: work (data) {warning ("error" + data);}, success: work (Data) {if (data. Ok) {$ ("# model"). Modal ('hide hdm (data);}}})
I checked in Fiddler and I I can see that the ID has passed correctly. I have a break point at the beginning of a method but this is not a hit Before the call crash
post http: // localhost: 1809 / creator / erase / 34 host HTTP / 1.1: local host: 1809 connection: survive content-length: 5 Accept: * / * RequestVerificationToken: TQY9NrchHlFT6IBaTv1R4daiwGoRH0yv3gHJwpatGj Origin: http: // localhost: 1809 With X-Requested: XMLHttpRequest User-agent: Mozilla / 5.0 (Windows NT 6.1; WOW64) Apple WebKat / 537.36 (like KHML, GIKO) Chrome / 34.0.1847.131 Safari / 537.36 Content-Type: Application / Jason; Charset = UTF-8 Referer: http: // localhost: 1809 / admin / index Accept-Encoding: gzip, air extract sdch Accept language: pl-pl, pl; Q = 0.8, en-US; Q = 0.6, n; Q = 0.4 cookie: __RequestVerificationToken = r5YwV -V id = 34
remove id url POST
is used in a GET
request from Url.Id. But if you want to use POST, then the data part of the AJAX call in Json.stringify ()
Comments
Post a Comment