title: Call a URL and get the return value. both Jquery and Javascript doesnt display the return value
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6235452/xmlhttprequest-responsetext-doesnt-write-the-value-when-calling-a-url">XMLHttpRequest.responseText doesnt write the value when calling a URL</a>  </p>
  </blockquote>
  
  
  
  <p>I ve written the code in both javascript and jquery to call a URL and get the return value by <strong>referring <a href="https://stackoverflow.com/questions/906876/call-a-url-from-javascript">here</a> and <a href="https://stackoverflow.com/questions/1632039/return-value-from-ajax-call">here</a>.</strong> </p>
  
  <p>But the return value of the aspx page doesnt get displayed in my html file. Since I am new to javascript and jquery, can you please let me know if I need to put a call back as its cross posting? if so, can you explain me?</p>
  
  <p><strong>The Javascript code is</strong> </p>
  
  <pre><code> &lt;script type="text/javascript" &gt;    
   var req ;
   // Browser compatibility check          
   if (window.XMLHttpRequest) {
   req = new XMLHttpRequest();
   } else if (window.ActiveXObject) {
  
   try {
   req = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
  
   try {
   req = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (e) {}
   }
  
  }
  
  
  var req = new XMLHttpRequest();
  req.open("GET", "http://www.example.com/Default.aspx?usrname=john",true);
  req.onreadystatechange = function () {
  document.getElementById('divTxt').innerHTML = "My Status: " + req.responseText;
  }
  
  req.send(null);
  &lt;/script&gt;
  
  &lt;/script&gt;
  &lt;html&gt;
  &lt;head/&gt;
  &lt;body&gt;
  &lt;div id="divTxt"&gt;&lt;/div&gt;&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <blockquote>
    <p><strong>The output I get is : My Status</strong> :</p>
  </blockquote>
  
  <p><strong>The JQuery code is</strong> </p>
  
  <pre><code> var html = $.ajax({
   url: "http://www.example.com/Default.aspx?usrname=john",
   async: true
   }).responseText;
   document.getElementById('divTxt').innerHTML = "My Status: " + html;
  </code></pre>
  
  <p><strong>The output I get is blank page</strong></p>
  
  <p>PS: I am <a href="https://stackoverflow.com/questions/6235452/xmlhttprequest-responsetext-doesnt-write-the-value-when-calling-a-url">reposting</a> the question again as my question was not answered properly before.</p>
  
  <p>**</p>
  
  <p><strong>> EDIT: in my original code, there is</strong></p>
  
  <blockquote>
    <p>http://</p>
  </blockquote>
  
  <p>**</p>