-
20 Apr 2012 1:54 PM #1
Unanswered: consuming a web service with sencha touch
Unanswered: consuming a web service with sencha touch
SALAM all.
i try to consume a web service.
i download a code from the kitchen of sencha and i tried to execute it but the only thing that display is an alert which i put it in the beginning of the code. here is the code which i wrote:
it's very important for me. please help meCode:var App = new Ext.Application({ name: 'webservice', useLoadMask: true, launch: function () { alert ("test json begin"); webservice.views.service = new Ext.Container({ config: { scrollable: true, items: [{ xtype: 'panel', id: 'JSONP' }, { docked: 'top', xtype: 'toolbar', items: [{ text: 'load using json-P', handler: function() { var panel = Ext.getCmp('JSONP'), tpl= new Ext.XTemplate([ '<div class="demo-weather">', '<tpl for=".">', '<div class="day">', '<div class="date">{date}</div>', '<tpl for="weatherIconUrI">', '<img src="{value}">', '</tpl>', '<span class="temp">{tempMaxF}°<span class="temp_low">{tempMinF}°</span></span>', '</div>', '</tpl>', '</div>' ]); panel.getParent().setMasked({ xtype: 'loadmask', message: 'Loading ......' }); Ext.data.JsonP.request({ url: 'http://free.worldweatheronline.com/feed/weather.ashx', callbackkey: 'callback', params:{ key: '23f6a0ab24185952101705', q: '94301', format:'json', num_of_days:5 }, callback: function(success, result) { var weather = result.data.weather; if (weather) { panel.updateHtml(tpl.applyTemplate(weather)); } else { alert('error retrieving weather'); } panel.getParent().unmask(); } }); } }] }] } }); webservice.views.Viewport = Ext.extend(Ext.Panel, { fullscreen: true, layout: 'card', cardSwitchAnimation: 'slide', items: [webservice.views.service] }); } });
-
23 Apr 2012 7:47 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 435
- Answers
- 3106
Are you using Sencha Touch 1 or 2?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
23 Apr 2012 12:12 PM #3
-
23 Apr 2012 12:19 PM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 435
- Answers
- 3106
I just see you use the config object which in this usage won't work with ST1 or ST2 but it's a ST2 thing for using Ext.define.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
23 Apr 2012 12:54 PM #5
and how can i consume a web service with sencha 1 ?? what kind of modification should i to do ?
-
23 Apr 2012 1:35 PM #6
pleaaaaaaaaaaaaaaaaaaaaase haw can i consume a web service with sencha 1



Reply With Quote