Forums/Community/Zendesk Apps

POST Response: How to Retrieve and Parse JSON in .done and .fail?

Jeff Tanner
posted this on August 23, 2012 17:46


After reading "Requests" section, it is not clear to me how to retrieve and parse POST Response.

For example, this POST Endpoint is expected to return upon status 200 a JSON object with mixed format: { responseType String, response Array }.

It is not clear how <ajax request>.done and <ajax request>.fail is expected retrieve and parse their respective JSON responses.

Example would be helpful

Thank you for your assistance

Jeff in Seattle




User photo
Thomas Balsløv

Hi Jeff.

I do it like this:

'fetchdata.done': function(data){
       services.notify('The request succeeded');

The response data (JSON object) is automagically added as a function parameter.

Best regards,
Thomas Balsløv.

September 13, 2012 06:56
User photo
Jeff Tanner

Thx for you reply

September 13, 2012 08:44