I found ASP.Net PageMethods very convenient and easy to use, but I just started developing using MVC and not sure how to use them?
What is equivalent PageMethods.MyFunction()in MVC where MyFunction is a controller action?
PageMethods.MyFunction()
I know that I can use a function Jsonto return a value, but how can I call an action from the client?
Json
I know that I can use the Json function to return a value, but how do I call an action from a client?
I think you're looking for either getJSON
$.getJSON("/controller/action", function(json) { alert("JSON Data: " + json.users[3].name); });
or ajax jQuery method.
JSON ASP.NET MVC .
, . asp.net - .
MVC , XHR url (../controller/action/params - ) JSON .
: , , , XHR . javascript XMLHttpRequest, JS, , , . , jQuery,