c# - How to read Ajax class response send from a ASP.NET MVC Contoller? -


Hello and many thanks for you! I'm new to web programming.

I have an Ajax call to the controller in ASP.NET MVC. After receiving the response, I try to get many notifications from the feedback and use it on my HTML.

  $ Ajax ("url.Action" ("function", "administrator"), data: JSON.stringify ({parameter: $ (this) .attr ("id")}, type: "post" Content type: "App / Jason", Timeout: 10000, Datatype: "Jason", Success ART ("value", result. ITR1); $ ("# text box 2") etter ("value", result. ATR2); $ ("# textbox3") Astrator ("value", result.ATT3);}  

Controller:

  Feedback {public string attr1; public string attr2; public string attr3;} [HttpPost] Public response function (string parameter) {response returnVal = new response (); returnVal.attr1 = "Dummy1"; returnVal.attr2 = "Dummy2"; returnVal.attr3 = "dummy 3"; return return value;}  

I get information in the controller, but when the reaction should not be anything I feel that there is an error or I badly parse the data.

Your answer Thanks for that!

you have tried

  Public JS Function (String parameter) {response returnVal = new response (); ReturnVal.attr1 = "Dummy1"; ReturnVal.attr2 = "Dummy2"; ReturnVal.attr3 = "Dummy 3"; Jason (Returnwell) returned; }  

Comments