PDA

View Full Version : Calling XML http URL in sencha javascript



devisri.sree
3 May 2011, 5:44 AM
Hi , im new to sencha touch , im trying to invoke server side http in my javascript, wen i run the code it displays the blank. Can any body help me pls

my index.html is
----------------

<!DOCTYPE html>
<html>
<head>
<title>xml Example</title>
<script src="../../sencha-touch.js" type="text/javascript"></script>
<link href="../../resources/css/sencha-touch.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="testurl.js"></script>
</head>

<body>

</body>
</html>


testurl.js
---------
urlcall = Ext.Application({
name: 'Test XML',

launch: function(){

Ext.regModel('user',{idProperty: 'id', fields: [{name:'name',type:'string'},{name:'email',type:'string'}]});

xmlStore = new Ext.data.Store({
model: 'user',
method: 'GET',
proxy: {
url: 'http://localhost/Rsalesarm/lib/touch/Rsales/list/users.xml',
type: 'ajax',
reader: {
type: 'xml',
record: 'user',
root: 'user'
}
}
});
xmlStore.load();

xmlList = new Ext.List({
title: 'xmlList',
fullscreen: true,
itemTpl: '<tpl for=".">{name}-{id}</tpl>',
store: xmlStore
});
p = new Ext.TabPanel({
fullscreen: 'true',
items: [xmlList]
});

}
});

users.xml
<?xml version="1.0" encoding="UTF-8"?>
<user>
<id>1</id>
<name>Ed Spencer</name>
<email>ed@sencha.com</email>

<id>2</id>
<name>Abe Elias</name>
<email>abe@sencha.com</email>
</user>

while calling this in VM player it displays the blank response. Where my mistake .can anybody help me out

Thanks in advance
Devi