views:

736

answers:

3

I am new at Mojo framework and Palm webOS. I want to just retrieve data from XML files using xmlhttprequest (Ajax). I am trying to get data from following script.

this.items = [];
var that = this;
var request = new Ajax.Request("first/movies.xml", {
            method: 'get',
            evalJSON: 'false',
            onSuccess:function(transport){
              var movieTags = transport.responseXML.getElementsByTagName('movie');
              for( var i = 0; i < movieTags.length; i++ ){
                 var title = movieTags[i].getAttribute('title');
                 that.items.push({text: title});
              }
            },
            onFailure: function(){ alert('Something went wrong...') }
        });  

My XML files are in the first/movies.xml folder. From that I am trying to access and retrieve data. but not display anything in the screen of Palm Pre emulator.

So can anyone is having idea about this issue? Please give a link where can I find the source code for getting data from XML files in webOS.

+1  A: 

Have you checked the path of the xml. I mean it should be "/first/movies.xml" instead of "first/movies.xml". and moreover if path is correct than do you really get any data in transport.responseXML. First try to check if it is getting any data in that. If there is any problem with url, you will not get any data in transport.responseXML.

Hope this helps.

LovePalmPre
thanks skaffman. the only mistake was "/" before path of xml. and now it will works. and getting data from xml files and fill into list box.
Brijesh Patel
A: 

Hi Brijesh,

I am new to Palm OS development. Could you explain in me detail on how web service request is made from Palm WebOS. I wanted to connect to a REST based web service. What should I do? Should I also use Ajax as have have done? Where do you specify your URL.

Regards, krishnan.

Krishnan
A: 

You need to let the controller know there was a change:

this.controller.modelChanged(xxx);

Good luck

XRAY Enabler