Search code examples
javascriptjquerybackbone.jsbackbone.js-collections

Fetch a collection using a POST request?


I have managed to work with REST API's to fetch() data where the urls contain minimal parameters (and use GET).

How would one retrieve a collection through a POST request?


Solution

  • Also note that fetch supports Jquery.ajax parameters, so you can easily set type = post in the call.

    Messages.fetch({data: {api_key: 'secretkey'}, type: 'POST'});
    

    For more parameters: http://api.jquery.com/jQuery.ajax/