response is not working

You must Login before you can answer or comment on any questions.

var button = Ti.UI.createButton({ left: 180, top: 180, width: 100, hight: 30, title: 'Go' }); self.add(button); button.addEventListener('click', function(e) {

// if(txtUserName.value == 'S0009231839' && txtPassword.value == 'm8390967743!'){

var xhr = Ti.Network.createHTTPClient(); // var authstr = 'Basic ' +Titanium.Utils.base64encode('S0009231839'+':'+ 'm8390967743!'); var authstr = 'Basic ' +Titanium.Utils.base64encode('S0009231839:'+ 'm8390967743!');

// xhr.open("POST","http://erp.esworkplace.sap.com/sap/bc/srt/wsdl/bndg_DF52FF9E9AF025F18F0400145E5ADE89/wsdl11/allinone/ws_policy/document?sap-client=800"); xhr.setRequestHeader('Authorization', authstr);
xhr.setRequestHeader('Content-Type','text/xml'); // xhr.setRequestHeader('SOAPAction','http://erp.esworkplace.sap.com/sap/bc/srt/wsdl/bndg_DF52FF9E9AF025F18F0400145E5ADE89/wsdl11/allinone/ws_policy/document?sap-client=800'); xhr.setRequestHeader('Accept-Language','en'); xhr.open("POST","http://erp.esworkplace.sap.com/sap/bc/srt/wsdl/bndg_DF52FF9E9AF025F18F0400145E5ADE89/wsdl11/allinone/ws_policy/document?sap-client=800");

// xhr.onload = function()

xhr.onload; { try { alert('before functi'); //get the xml data and let it roll! var doc = xhr.responseXML.documentElement; var items = doc.getElementsByTagName('wsdl:portType');

alert('after portType');
for(var c=0; c<items.length;c++){
var item = items.item(c);
alert(items.length);
var attributeEmployeeLeave = items.item(c).attributes.getNamedItem("name").nodeValue;
Ti.API.info(items.item(c).attributes.getNamedItem("name").nodeValue);     
}

} catch(E) { alert('error on xhr'); } } // if(txtUserName.value != 'S0009231839' && txtPassword.value != 'm8390967743!'){ var win = Titanium.UI.createWindow({

    url:'/ui/handheld/secondView.js',
    title:'HALLIBURTON',
    backgroundColor:'#fff',                 
    backButtonTitle:'Back'
});

// } // if(txtUserName.value == 'S0009231839' && txtPassword.value == 'm8390967743!'){

self.containingTab.open(win);
// }

}); Not able to get response when i am writing code inside button Event Listener, if i write code out side the button Event listener its working fine!

— asked 11 months ago by kiran arishanapalli
4 Comments
  • may i know why i get -1 vote!

    — commented 11 months ago by kiran arishanapalli

  • Because you posted twice the same problem, and you don't format your code.

    — commented 11 months ago by Dan Tamas

  • @Dan Tamas OMG i got -2 ! yeap because i did not include titaninum in my first question sir! i do apologies

    — commented 11 months ago by kiran arishanapalli

  • Show 1 more comment

Your Answer

Think you can help? Login to answer this question!