|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Junior Member
Iscritto dal: Oct 2006
Messaggi: 3
|
[JavaScript] Access to restricted URI denied
Ciao a tutti, vi propongo un piccolo errore che mi esce quando faccio un chiamata HttpRequest di una pagina XML, che prende come parametri R e N (precisamente dell'armory di world of warcraft)
esempio del link: http://eu.wowarmory.com/character-sh...Hakkar&n=Savvo Codice:
function ajax(handler) {
var xmlhttp = null;
try {
xmlhttp = new XMLHttpRequest();
} catch(e) {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
xmlhttp.onreadystatechange = handler;
return xmlhttp;
}
function prendiNome(regex) {
var pattern=new RegExp("(?<=theCharName\\s=).*");
var nome=regex.search(pattern);
alert(nome);
}
var f=null;
function handler_catturaInfo() {
alert("evocato");
if(f.readyState==4) {
alert(f.responseText);
prendiNome(f.responseText);
}
}
function catturaStringa(nick,realm) {
f=new ajax(handler_catturaInfo);
var str="http://eu.wowarmory.com/character-sheet.xml?r="+realm+"&n="+nick;
f.open("GET",str,true);
f.send("r="+realm+"&n="+nick);
}
Sapete aiutarmi? Grazie per il vostro aiuto |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Nov 2003
Messaggi: 980
|
Access to restricted URI denied su google o anche Cross domain ajax.
In poche parole, non puoi fare una richiesta ajax a un url al di fuori del tuo dominio. Puoi però fare una richiesta a un file php/asp sul tuo server che richiede la pagina remota e te la restituisce. |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 19:33.



















