Note that there are some explanatory texts on larger screens.

plurals
  1. POxmlHttp.responseText comes empty
    primarykey
    data
    text
    <p>xmlHttp.responseText comes empty, what is the problem and solution?</p> <p><strong>default.aspx :</strong></p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="xmlHttpOrnek._Default" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head runat="server"&gt; &lt;script type="text/javascript"&gt; var xmlHttp; function GetXmlHttpObject() { var xmlHttp = null; try { // Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } //-------------------------- function callAjaxFunc(val) { xmlHttp = GetXmlHttpObject(); if (xmlHttp == null) { alert("Browser does not support HTTP Request"); return; } //you can provide your page URL var url = "Default.aspx"; url = url + "?kod=" + val; //state change event-this will occur ass soon as response comes from the url xmlHttp.onreadystatechange = stateChanged; xmlHttp.open("GET", url, true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState == 4) { //Display contents var xmlResponse = xmlHttp.responseText; if (xmlResponse != '') { var inputMessage = document.getElementById('txb'); inputMessage.value = xmlResponse.toString(); alert(xmlResponse); } } } &lt;/script&gt; &lt;title&gt;Untitled Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;asp:textbox ID="txb" runat="server"&gt;&lt;/asp:textbox&gt; &lt;asp:Button ID="btn" runat="server" Text="bas" OnClientClick="callAjaxFunc('y')" /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>default.aspx.cs:</strong></p> <pre><code>using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; namespace xmlHttpOrnek { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string d = Request.QueryString["kod"]; if (Request.QueryString["kod"] == "y") { Response.Write("Başarılı!"); Response.End(); } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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