i careate a function in javascript in titanium.
function getdetail(Success){
alert("hit the function");
var detail[];
$.ajax({
type: "GET",
url: "Detail.xml",
dataType: "xml",
success: function(xml) {
alert(xml);
detail.push(xml);//fill data by finding root each
sucess(detail);
}
});
return detail;
}
by qunit test i want to test this ,
test("test for detail",function(){
stop();
getdetail(function(detail){
start();
ok(true);
})
})
But some how it give me undefined value, null value, because i placed a alert inside the ajax function. this alert was not hit. then i place a alert outside the ajax function this was hit.
whole work i am doing with apslator titanium developer using aptana studio.
how can i test this javascript titanium function function
First thing I would do is install Titanium Studio either on top of Aptana or standalone and then start using the Ti.API.* for you’re debugging instead of
alerts. Also what exactly are you trying to accomplish. I can’t tell from you’re question what you are trying to do fully?