https://blog.csdn.net/ydm19891101/article/details/44336951
Previous article asp.net mvc @model and model explain how the background controller to the front page to pass data, and today we will explain the front view page back to the table controller controller to pass data several ways. These are some of the ways I use in practice and summed up, if that place is wrong or have deficiencies, you are welcome to point out and give constructive advice, and learn together.
1, asynchronous mode
In actual project development, we often need to submit data asynchronously, we can get some important information without submitting the current page. This will neither waste network resources nor cause server load. The main asynchronous methods are Ajax, post, get three kinds of
(1) Ajax Way
[javascript] View Plain copy/* To determine if the user has logged on to */ $ (function () { $.ajax ({ type: "POST", url: "/MONTHWIN/INDEX/12", data:{"name": Name, "Sex":sex}, dataType: ' JSON ', success: function (Result) { if (result == true) { isLogin = true; } else { isLogin = false; } }            &NBSP});    &NBSP})
(2) Post mode
[javascript] View Plain copy $.post (url, { "username": username, "province": province, "City": city, "branch": branch, "number": number, "Bankname": bankName }, function (Result) { if (result == "1") { alert ("Save Success"); Location.reload (); &nbSP;} else { alert ("Save Failed"); location.reload (); }        &NBSP});
Summary: The asynchronous approach is also simpler to implement, of course, this is only one aspect. The most important point is that the value can be returned. We can do the next step based on the values passed in the background, while reducing the server request and reducing the network load.
2. Form mode
(1) Post mode
<1> post way without JS, direct submission
[HTML] View plain copy <form onsubmit= "Layer.load (' Submit in Request ')" action= "/WITHFUNDING/STARTFUNDING/12" method= "POST" > <input type= "hidden" name= CategoryID value= "/>" <input "type=" hidden "name=" Accountmoney "value=" @Vi Ewbag.account "/>