Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is the thing, there is no way to "temporarily" disable cross-domain XMLHttpRequest, if you can disable it temporarily then it can be disabled permanently. This is a rather common problem in the modern-day of AJAX programming and is most often solved using the technique known as cross-domain scripting. </p> <p>The idea here being is that if you call out to a cross-domain script it returns JavaScript (JSON) results that are then passed on to a function on your end. </p> <p>Here is some sample code to illustrate how it may look from a JavaScript code perspective:</p> <pre><code> function request_some_data() { var s = "http://my.document.url.com/my_data?p1=v1&amp;p2=v2&amp;callback=myfunc"; try { try{ document.write("&lt;scr"+"ipt type='text/javascript' src='"+s+"'&gt;&lt;/scr"+"ipt&gt;"); } catch(e){ var x = document.createElement("script"); x.src = s; document.getElementsByTagName("head")[0].appendChild(x); } } catch (e) { alert(e.message); } } </code></pre> <p>You will then define a function in your code that receives the data and in the server you "handle" the callback case, here is the client-side JavaScript:</p> <pre><code>function myfunc(data) { alert(data); } </code></pre> <p>And on the server side, here i'm giving a PHP example but this can be done just as easily in Java or what-ever your server-side technology is:</p> <pre><code>&lt;?php if($_GET["callback"]) { print($_GET["callback"] . "("); } /* place your JSON object code/logic here */ if($_GET["callback"]) { print(");"); } ?&gt; </code></pre> <p>Note that what you are generating on the server side winds up being some JavaScript that gets executed on the client side.</p>
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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