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

Ref: http://developer.zendesk.com/documentation/apps/requests.html

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

For example, this POST Endpoint https://int.tangocard.com/Version2/GetAvailableBalance 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

 

 

Comments

User photo
Thomas Balsløv
panorama9

Hi Jeff.

I do it like this:

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

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
tangocard

Thx for you reply

September 13, 2012 08:44