[Javascript][XUL] un setAttribute après un XMLHttpRequest
Bonjour,
Je travaille sur une extension de Firefox, en XUL, et j'ai un problème dans l'une de mes fonctions que voici :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
function Zar(){
var ticket = getTicket();
p = new XMLHttpRequest();
p.onload = null;
p.open("POST", "http://xxxxx/general.asmx?WSDL", true);
p.setRequestHeader("SOAPAction", "https://xxxxx/general");
p.setRequestHeader("Content-Type","text/xml; charset=utf-8");
try{
p.send("<?xml version='1.0' encoding='utf-8'?>"+
"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"+
"<soap:Header>"+
"<essai xmlns='https://xxxxx/general'>"+
"<ticket>"+ticket+"</ticket>"+
"</essai>"+
"</soap:Header>"+
"<soap:Body>"+
"<NomMethode xmlns='https://xxxxxx/general' />"+
"</soap:Body>"+
"</soap:Envelope>");
}catch(error){
alert("le send n'a pas marche");
}
alert("ready");
if ( p.status != "200" ){
alert("Probleme a l'identification, veuillez recommencer");
}else{
var contenu = p.responseXML;
var val = contenu.getElementsByTagName("NomMethodeResult")[0].firstChild.nodeValue;
if (window.opener.document.getElementById("Zar") != null){
window.opener.document.getElementById("Zar").setAttribute("tooltiptext",val);
}else{
alert("probleme");
}
}
} |
Ce script marche parfaitement.
Ce qui est bizarre, c'est que si je mets le alert("ready"); en commentaire, il ne marche plus.
Quelqu'un aurait-il une idée sur la question?