asp.net - Invoke server side method using XMLHttpRequest -
How can I call my own server-side function directly using XMLHttpRequest?
Assume that I have a static WebMath in my aspx file, how can I call it by XMLHttpRequest ASPN.NN? What is the header information to pass the engine and as a result, asp.net engine can implement my method and return the feedback in the outgoing stream.
This way I need to call my server side method
& lt; Script type = "text / javascript" & gt; Request var // A // This is a new function called when the user submits the form. // This example uses POST. Submit the functionCalback () {var inputValue = document.getElementById ("SearchInput"). Values; Var sendStr = "name =" + input value; Request = new XMLHttpRequest (); //b // specify the post method and send it Request.open ("Post", "Default.aspx / GetData"); Request.onreadystatechange = ready callback; Request.setRequestHeader ("content-type", "app / x-www-form-url expired"); Request.setRequestHeader ("islookup", "true"); Request.send (sendStr); } & Lt; / Script & gt; Please guide me .... Thanks
me Believe you are probably referring to the methods of ASP.NET page when you say a stable WebMath in my aspx file ASP.Net page methods (or web service for consumption in JS). Uses JSON's serialization for P / O and P, so you need to set JSON as the content type for the request and Actually send the JSON string to the body i.e.
Comments
Post a Comment