roymj88
13 Dec 2011, 2:50 AM
Hi,
I am developing a simple application which unfortunately for me needs access to database. While the app works perfectly while running through url, it does not work when used as an iphone app. The problem is the xml parsing is not taking place properly.
function login(){
$.ajax({
type: "GET",
url: "http://www.sicsglobal.com/projects/classapp/class-app-xml/login.xml",
dataType: "xml",
success: parseXml
});
function parseXml(xml) {
var schoolname = document.getElementById("schoolname").value;
var activation = document.getElementById("activation").value;
$(xml).find("login").each(function(){
var username = $(this).find("username").text();
var password = $(this).find("password").text();
if((schoolname==username)&&(activation==password)){
Test.Viewport.setActiveItem('second',{type:'slide', direction:'left'});
}
else{
document.getElementById('login_response').innerHTML = '<br><span style="color:#FFF">Invalid schoolname/activation code</span>';
}
});
}
}
The url does not work
url: "http://www.sicsglobal.com/projects/classapp/class-app-xml/login.xml",
Is there any way around this? I just need to compare details from database. Kindly help. All the screens are done and now only thing pending is filling up the screens with data fetched from database through xmls.
Thanks
Roy M J
I am developing a simple application which unfortunately for me needs access to database. While the app works perfectly while running through url, it does not work when used as an iphone app. The problem is the xml parsing is not taking place properly.
function login(){
$.ajax({
type: "GET",
url: "http://www.sicsglobal.com/projects/classapp/class-app-xml/login.xml",
dataType: "xml",
success: parseXml
});
function parseXml(xml) {
var schoolname = document.getElementById("schoolname").value;
var activation = document.getElementById("activation").value;
$(xml).find("login").each(function(){
var username = $(this).find("username").text();
var password = $(this).find("password").text();
if((schoolname==username)&&(activation==password)){
Test.Viewport.setActiveItem('second',{type:'slide', direction:'left'});
}
else{
document.getElementById('login_response').innerHTML = '<br><span style="color:#FFF">Invalid schoolname/activation code</span>';
}
});
}
}
The url does not work
url: "http://www.sicsglobal.com/projects/classapp/class-app-xml/login.xml",
Is there any way around this? I just need to compare details from database. Kindly help. All the screens are done and now only thing pending is filling up the screens with data fetched from database through xmls.
Thanks
Roy M J