Note that there are some explanatory texts on larger screens.

plurals
  1. POXML handle response error with external access
    primarykey
    data
    text
    <p>I have an JavaScript(AJAX) code which takes data from an php file (Pagerank Script which returns an variable $prr=6 where 6 is pagerank of the verified link) using GET and transform it in xml file to become handable for java.</p> <p>This is the function wich creates Xml Http Request:</p> <pre><code> var xmlHttp = createXmlHttpRequestObject(); function createXmlHttpRequestObject(){ var xmlHttp; if(window.ActiveXObject){ try{ xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){ xmlHttp = false; } }else{ try{ xmlHttp = new XMLHttpRequest(); }catch(e){ xmlHttp = false; } } if(!xmlHttp) alert("Nu pot crea XML!"); else return xmlHttp; </code></pre> <p>}</p> <p>This is the process function:</p> <pre><code> window.onload = function process(){ if(xmlHttp.readyState==0 || xmlHttp.readyState==4){ link = encodeURIComponent(value = 'google.ro'); local = '/v1.php?verifica='; xmlHttp.open("GET", local+link,true); xmlHttp.onreadystatechange = handleServerResponse; xmlHttp.send(null); }else{ } } </code></pre> <p>And this is Handle the response of the server:</p> <pre><code> function handleServerResponse(){ if(xmlHttp.readyState==4){ if(xmlHttp.status==200){ xmlResponse = xmlHttp.responseXML; xmlDocumentElement = xmlResponse.documentElement; message = xmlDocumentElement.firstChild.data; document.getElementById("Raspuns").innerHTML = message; }else{ alert("Probleme cu datele returnate de server!"); } } } </code></pre> <p>I have an document writer for generating id tag for getElementById()</p> <pre><code>document.write('&lt;script type="text/javascript" src="http://verificapagerank.32biti.com/java/verifica.js"&gt;&lt;/script&gt; &lt;div id="Raspuns"&gt;&lt;/div&gt;'); </code></pre> <p>This is the code for including javascript file: </p> <pre><code> &lt;script type="text/javascript" src="http://verificapagerank.32biti.com/java/calculator.js"&gt;&lt;/script&gt; </code></pre> <p>All is fine until i put the code on external site! On external files I get alert error from <code>handleServerResponse()</code> </p> <pre><code>`Probleme cu datele returnate de server!` </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