-
3 May 2012 9:05 AM #1
Unanswered: consume a web service with sencha touch 1
Unanswered: consume a web service with sencha touch 1
SALAM all.
please i want to soncume a web service made with WCF, with sencha touch 1.
here is a link to my web service 'http://localhost:8732/Service1/data/10' its return a JSON file
{"Id":10,"Name":"Leo Messi"}
Now i want to consume it with sencha touch 1, i try few code but without success.
please please how can i consume it. its very important for me.
thank you
-
5 May 2012 5:52 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3155
Are you launching the app from localhost:8732? If so, you can use ajax with no problems. If not then you need to use jsonp or the scripttagproxy and have the JSON returned within the callback function specified in the request.
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.
-
5 May 2012 12:22 PM #3
thank you michelle.
but the problem that i don't know how using jsonp or the scripttagproxy with sencha 1. in the kitchen of sencha they do it it with sencha2.
I know Ibother youa bit but,can you correct methis code?
thank youCode:var App = new Ext.Application({ name: 'webservice', useLoadMask: true, launch: function () { alert ("test json begin"); webservice.views.show = new Ext.Ajax.request({ id: 'show', items: [{ xtype: 'panel', id: 'JSONP', url :'http://localhost:8732/Service1/data/10', success : function() { tpl= new Ext.XTemplate([ '<div >', '<tpl for=".">', '<div >', '<div class="Id">{Id}</div>', '<span class="Name">{Name}</span>', '</div>', '</tpl>', '</div>' ]); } method: 'Get', }] }); webservice.views.Viewport = Ext.extend(Ext.Panel, { fullscreen: true, layout: 'card', cardSwitchAnimation: 'slide', items: [webservice.views.show] }); } });


Reply With Quote