-
27 Dec 2012 4:02 AM #1
Jsonp request is failing for some services
Jsonp request is failing for some services
here is my code, it works fine for certain urls
i have no server side access to these public services
working serviceCode:Ext.data.JsonP.request( { url:"http://money.rediff.com/money1/current_status_new.php?companylist=17023928|17023929&id=1354690151&Rand=0.6305125835351646", callbackKey: 'callback', success: function(response) { alert('Working'); console.log(response); }, failure: function(response) { alert('Not working!'); console.log(response); } });
Failing service (This returns a json response in browser/response tab)Code:"http://query.yahooapis.com/v1/public/yql?q=select * from xml where url%3D'http%3A%2F%2Fcloud.tfl.gov.uk%2FTrackerNet%2FPredictionDetailed%2FB%2FBST'"
some one please help me in accessing above service, i need to implement cross domain access from native appsCode:http://money.rediff.com/money1/current_status_new.php?companylist=17023928|17023929&id=1354690151&Rand=0.6305125835351646
thanks
arun
-
28 Dec 2012 7:12 AM #2
Brice Mason
Front End Developer
Modus Create
@bricemason
bricemason.com
Sencha Touch Screencasts
Vimeo - Sencha Touch Channel
Github Projects:
Sencha Cordova Builder enables the automatic creation, building, and running of PhoneGap (Cordova) projects with Sencha Touch.
Am I Sencha Touch Ready? checks your system to determine what you need to do to start Sencha Touch development. If you're having trouble getting up and running, try this out.
Sencha Tools Bridge allows Sencha SDK Tools to co-exist with Sencha Cmd on the same system.
-
30 Dec 2012 10:36 PM #3
thanks bricemason,
I have checked the thread in detail.
is there any custom options possible to access data from this type of json service?
Thanks
Arun Sathyan
-
31 Dec 2012 6:06 AM #4
I'm not sure what you mean. If you decided to go the route of writing your own server-side implementation to access this service, then you'd probably use an ajax proxy. You can review the options for that proxy here:
http://docs.sencha.com/touch/2-1/#!/...ata.proxy.Ajax
BriceBrice Mason
Front End Developer
Modus Create
@bricemason
bricemason.com
Sencha Touch Screencasts
Vimeo - Sencha Touch Channel
Github Projects:
Sencha Cordova Builder enables the automatic creation, building, and running of PhoneGap (Cordova) projects with Sencha Touch.
Am I Sencha Touch Ready? checks your system to determine what you need to do to start Sencha Touch development. If you're having trouble getting up and running, try this out.
Sencha Tools Bridge allows Sencha SDK Tools to co-exist with Sencha Cmd on the same system.
-
1 Jan 2013 2:19 AM #5
thanks again,
i need to access json service using jsonp request (cross domain).
Is it possible to implement such a call?
Existing service is having json response without root element.
ArunCode:[{"CompanyCode":"17023928","LastTradedPrice":"19,580.81","Volume":"0","PercentageDiff":"0.79","FiftyTwoWeekHigh":"19,612.18","FiftyTwoWeekLow":"15,358.02","LastTradedTime":"01 Jan,15:46:30","ChangePercent":"0.79","Change":"154.10","MarketCap":"0.00","High":"19,623.76","Low":"19,508.93","PrevClose":"19,426.71","OpenInterest":"","MarketLot":"","ChangeInOpenInterest":"","Symbol":null},{"CompanyCode":"17023929","LastTradedPrice":"5,950.85","Volume":"0","PercentageDiff":"0.77","FiftyTwoWeekHigh":"5,965.15","FiftyTwoWeekLow":"4,686.85","LastTradedTime":"01 Jan,15:46:37","ChangePercent":"0.77","Change":"45.75","MarketCap":"0.00","High":"5,963.90","Low":"5,935.20","PrevClose":"5,905.10","OpenInterest":"","MarketLot":"","ChangeInOpenInterest":"","Symbol":""}]
-
2 Jan 2013 5:48 AM #6
A jsonp request is not possible with this service because it's not returning jsonp. It is returning json. Read these docs to learn more about jsonp:
http://docs.sencha.com/touch/2-1/#!/...ta.proxy.JsonP
You can solve this using the other ways that I've outlined in the previous threads. Do you have access to your server-side code? If so, what is the platform (PHP, Java, etc)? One way to solve this is to use your server-side code to make requests against the service you want then pass through the results to your client-side code.
But again, the short answer is that this service you're attempting to use is not returning jsonp so you can't use it that way.
BriceBrice Mason
Front End Developer
Modus Create
@bricemason
bricemason.com
Sencha Touch Screencasts
Vimeo - Sencha Touch Channel
Github Projects:
Sencha Cordova Builder enables the automatic creation, building, and running of PhoneGap (Cordova) projects with Sencha Touch.
Am I Sencha Touch Ready? checks your system to determine what you need to do to start Sencha Touch development. If you're having trouble getting up and running, try this out.
Sencha Tools Bridge allows Sencha SDK Tools to co-exist with Sencha Cmd on the same system.
-
2 Jan 2013 9:00 AM #7
thanks Brice,
i got a better understanding now, i dont have access to the server side, i will try to find some other alternative solution.
Arun


Reply With Quote