Pasteur Miranda
Posts: 0
Joined: Thu Aug 01, 2013 2:59 am

How to handle jqXHR object

When I invoke the service and go to the "Preview" tab in network, I do receive the "DENIED;" response as you received. But I receive, also, the ERROR alert indicating that the ERROR event of the datasource was raised. Could You try to put an ERROR event in the datasource and tell me if it's raised too?

Code: Select all

Thank yoy
maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to handle jqXHR object

I think the error handler is called because no valid JSON is returned. Can you try returning a JSON response?

Pasteur Miranda
Posts: 0
Joined: Thu Aug 01, 2013 2:59 am

How to handle jqXHR object

Hi Max,

Code: Select all

Yes, I can try. But according to "Building an App with Facebook API"  tutorial ( [url=http://docs.appery.io/tutorials/build-an-app-with-facebook-api/]http://docs.appery.io/tutorials/build...[/url] ) I understood that it's possible to handle "not Json" or "not XML" responses (see item "Exchange the code for a user access token" ).  

Thank you

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to handle jqXHR object

The 'complete' callback is used there.. it will always be called after either success/error. I'm guessing error callback is also invoked there.. just nothing happens there.

Pasteur Miranda
Posts: 0
Joined: Thu Aug 01, 2013 2:59 am

How to handle jqXHR object

Hi Max,

Code: Select all

Your last comment was very helpful. It worked! Despite the ERROR event is raised, I handled the COMPLETE event and got the returned text using the following code: 

         var vars = jqXHR.responseText.split("&");  
         alert(vars[0]); 

As a suggestion, I think you could add "text" option to the Data Type property of the service definition so that the ERROR event is not raised.

Thank you very much for your amazing application builder and also amazing support!

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to handle jqXHR object

I will check whether an error should be thrown if no JSON is returned.

Return to “Issues”