1
Salutations,Appcelerator modifier le texte du bouton
J'essaie de changer le texte sur un bouton dans appcelerator.
Maintenant, je peux le changer une fois, mais je ne peux pas changer le texte une fois qu'un événement se produit.
Voici le code:
var login=Titanium.UI.createButton({
title:'Login',
width:250,
top:330
});
win.add(login);
var xhr=Titanium.Network.createHTTPClient();
login.addEventListener('click', function(e){
login.title="Please wait..."; //this line works fine
xhr.onload=function(){
login.title="Login"; //this line doesn't work
if(uname.hasText){
uname.value=this.responseText;
}
};
xhr.onerror=function(){
login.title="Login"; //this line doesn't work
alertDialog.show();
};
xhr.open("POST","http://www.asdf.com/ajax/login.php");
if(uname.hasText && pword.hasText){
xhr.send({"uname":uname.value,"pword":pword.value});
}else{
alertDialog.show();
}
});
Je ne sais vraiment pas quoi faire à ce point!
Toute idée grandement appréciée.
Un grand merci à l'avance,
Hey, j'ai essayé et je ne peux toujours pas changer le texte à l'intérieur xhr.onload = function() { } – Eamorr
pouvez-vous poster le code mis à jour? –