title: Get JSON via javascript [Cross-Domain]
body: <p>Please help me with the following situation:</p>
  
  <p>there is the page p1.aspx with only one button:</p>
  
  <pre><code>&lt;button id="btn1" onclick="btnclick();"&gt;Button&lt;/button&gt;    
  &lt;script type="text/javascript"&gt;
    $('#btn1').click(function () {
      $.getJSON("http://localhost/p2.aspx", function (data) {
        $.each(data, function (i, field) {            
          alert(field);
        });
      });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>Above is how I want to get the JSON text via javascript.</p>
  
  <p>Web application <code>http://localhost/p2.aspx</code> is redirected to <code>http://localhost/p3.aspx</code> inside. And the page <code>http://localhost/p3.aspx</code> again is redirected back to 
  <code>http://localhost/p2.aspx?code=1</code>.</p>
  
  <pre><code>code=1
  </code></pre>
  
  <p>is the value I want read in my javascript code. But it's not works.</p>
  
  <p>In p2.aspx I generate JSON data as following</p>
  
  <pre><code>Response.Clear();
  Response.ContentType = "application/json; charset=utf-8";
  Response.Write(jsonString);
  Response.End();
  </code></pre>
  
  <p>After this I can not read json data via javascript. But if I just put the  <code>http://localhost/p2.aspx</code> via web browser then it get json data on the page.</p>