Note that there are some explanatory texts on larger screens.

plurals
  1. POAJAX: I am unable to fetch the data from server side
    text
    copied!<p>I need to get output from my server side code but i am able to fetch it. I have used script manager and script manager proxy control in master page. How can i get the string that is being returned from the cs file Here is my Default.aspx code</p> <pre><code>&lt;asp:UpdateProgress runat="server"&gt; &lt;ProgressTemplate &gt; Loading.......... &lt;/ProgressTemplate&gt; &lt;/asp:UpdateProgress&gt; &lt;asp:UpdatePanel runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:Label ID="lbl" Text="Enter Your Name" runat="server"&gt;&lt;/asp:Label&gt; &lt;input type="text" id="txt" /&gt;&lt;br /&gt; &lt;input type="button" id="btn" value="Submit" onclick="makeGetRequest()" /&gt; &lt;div id="description"&gt;Hello&lt;/div&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;script language="Javascript" type="text/javascript" &gt; function createRequestObject() { var tmpXmlHttpObject; if (window.XMLHttpRequest) { // Mozilla, Safari would use this method ... tmpXmlHttpObject = new XMLHttpRequest(); } else if (window.ActiveXObject) { // IE would use this method ... tmpXmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP"); } return tmpXmlHttpObject; } var http = createRequestObject(); function makeGetRequest() { http.open('post', 'Default.aspx/greet',true); //assign a handler for the response http.onreadystatechange = processResponse; //actually send the request to the server http.send(null); } function processResponse() { if (http.readyState == 4) { var response = http.responseText.toString(); alert("Inside here before"); document.getElementById('description').innerHTML = response; alert("Inside here after"); } } &lt;/script&gt; // my default.aspx.cs file [WebMethod(EnableSession=false)] public static string greet() { return "hello"; } </code></pre> <p>I am getting all contents of the page copied instead of getting response from it</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload