Following is an example using that approach: As not all of the controller action requires this, normally I would implement an Action Filter for this purpose and make the validation there but your requirements have other concerns which makes this option, well not an option. Controllers [UPDATED] My colleague Youssef suggested a very easy approach using Action Filter.Java Script does this by using XMLHttp Request and receiving the content of an xml file in response.The xml file can then be processed and used to modify various elements on your web page, which is illustrated in Example 2. You can see it in action on-line (below), or when you upload it to your web server. To better understand what is going on, let us examine all the files being used.The load Data() function creates and then makes the XML request.For the sake of simplicity, the URL is the xml file itself (our Data.xml).NET: The Blog Id needs to be validated on the server to ensure it belongs to the current (authenticated) user. I would also like to infer the user's default blog Id if it is not specified in the request (for simplicity you can assume that default is the user's first blog).
In many cases, the data is not readily available and must be assembled by a process or from a database.In more complex applications, the URL could be a call to a php, asp, or some other process responsible for assembling and returning the XML data, for example: https://c-point.com/ajax.php?params=some parameters here Observe the line xml Req.onreadystatechange = function(): it defines an anonymous function (in this case) to call whenever the ready State shanges.It is lightweight: only small amounts of data (in the XML form) are being exchanged through the Internet, making your web applications very fast.The loaded script runs immediately in the document context, allowing you to modify page elements as needed. Study the code in the following example to see how everything hangs together. To see the example in action: The function load Script is stored in the file.