Page 2 of 2

Got 'undefined' parse error for service

Posted: Wed Jul 16, 2014 7:11 am
by hb condo

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.


Got 'undefined' parse error for service

Posted: Wed Jul 16, 2014 11:51 pm
by Yurii Orishchuk

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.


Got 'undefined' parse error for service

Posted: Thu Jul 17, 2014 5:32 am
by hb condo

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.


Got 'undefined' parse error for service

Posted: Thu Jul 17, 2014 8:57 pm
by Kateryna Grynko

Hi,

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

If you see both alerts then both events fire.


Got 'undefined' parse error for service

Posted: Fri Jul 18, 2014 5:43 am
by hb condo

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?


Got 'undefined' parse error for service

Posted: Sun Jul 20, 2014 10:48 pm
by Yurii Orishchuk

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.