hb condo
Posts: 0
Joined: Mon Jul 14, 2014 7:38 am

Got 'undefined' parse error for service

Yurii, thank you for taking the time to write out the code. We have successfully added this generic service to our app. We are wondering how we can incorporate this as a REST service instead of a generic service so Appery handles the ajax request/response and not our own implementation.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Got 'undefined' parse error for service

Hello,

Yes you can do it,

Please follow these steps:

1 Create REST service. http://prntscr.com/43f0d6/direct

2 Put "http://autoc.finance.yahoo.com/autoc" as URL.

3 Set "data type" as "jsonp".

4 Add this service to the page as datasource: http://prntscr.com/43f1k1/direct

5 Open "EVENTS" bottom panel and add "success" event handler for datasource from 4 step. Populate it with following code: http://prntscr.com/43f5mr/direct

pre

if(!self.YAHOO !YAHOO.Finance !YAHOO.Finance.SymbolSuggest)
self.YAHOO = {Finance: {SymbolSuggest: {} } };

YAHOO.Finance.SymbolSuggest.ssCallback = function (data) {
alert(data.ResultSet.Result);
};

YAHOO.Finance.SymbolSuggest.ssCallback(data);

/pre

6 Invoke this service on event you need on the page.

Regards.

hb condo
Posts: 0
Joined: Mon Jul 14, 2014 7:38 am

Got 'undefined' parse error for service

Yurii, thank you again for the code. Unfortunately I'm back where I was before where the 'success' event isn't being executed but the 'complete' event is even though the ajax call returns a 200 http response with results.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Got 'undefined' parse error for service

Hi,

You can add Success and Complete event handlers:prealert("success");/preAnd:prealert("complete");/preaccordingly.

If you see both alerts then both events fire.

hb condo
Posts: 0
Joined: Mon Jul 14, 2014 7:38 am

Got 'undefined' parse error for service

Katya, I can confirm that the alert occurs for the complete event but not for the success event. When I debug the response on the complete event, it shows a 200 http response with a complete data being returned. Do you think the succes event is not being executed because of the Got 'undefined' parse error in the rest service setup shown in the beginning of this thread?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Got 'undefined' parse error for service

Hello,

Yes you are right,

Unfortunatly this 3rd party api has some not specialized in JSONP limitations.

For example if you paste this into the browser:

http://autoc.finance.yahoo.com/autoc?...

It will return correct 200 response.

But if you change anything in the callback - it returns 400 error.

http://autoc.finance.yahoo.com/autoc?...

Appery.io does not provide usage of some single certain callback cause it is not allowed to use several service calls simultaniously. But Appery.io supports this, that is why Appery.io generates callback name automaticaly.

So only way for your is just to use solution described above with generic service.

Regards.

Return to “Issues”