Passing form data to asp.net mvc controller action using JQuery -
Actually, I have an HTML form and the data is passed through the data as the asp net MVC controller
Client:
$ (function () {$} ('#btnSubmit') Click (function ($ .post ('/ home / create' , $ ('Form'). Serialize (), function (data) {$ ('# entryForm'). $ ('Form'); // $ ('# entryForm form') .html (data); alert Data (); $ (data). Game ('person'). Each (function () {warning ($ (this) .attr ('lastname'). Val ());});}, "xml"); Returned;});});
Here's the action of my controller The code is:
Create a public functioning (person p) {// person p = new person (); //p.Listname = lastname; //p.firstname = firstname; // P.middlename = middlename; // This XML data returns new XMLRsult (P);}
When I run and debug, I get a message that says "etter (..) is zero or no. Please help me identify that what I am doing wrong any suggestions will be appreciated happily, because I am still Using Mr. Aspiknet MVC'm trying to web development learning.
Thanks
Most
I realized that I This was fixing, here is my update code for client side:
$ (function () ($ ('# btn submit') click (function () {$ .post} ('/ Home / create', $ ('form'). Serialize (), function (data) {$ ('# entryForm') .remove ('form'); // $ ('# entryForm form') Html (data); $ (data) .find ('person'). (Function () {var $ lastname = $ (this) .find ('lastname'). Text (); var $ firsttname = $ (this ) .find ('first name'). Text (); Var $ middlename = $ (this) .find ('middlename'). Text (); // alert ('& lt; p & gt; last name:' + $ lastname + '& lt; / p & gt; ); $ ('& Lt; p & gt; & lt; / p & gt;') .HTML ($ lastname) .appendTo ('# detailsForm');});}, "Xml"); Details are false ;});});
Now, my next challenge will be, how do I send XML files, how to do the client using ASP.NET MVC so that I can process XML Can I use Java for?
Thanks
Comments
Post a Comment