BEEPS AND BLIPS FROM OUTERSPACE
HOW TO SEND URL PARAMETERS IN BACKBONE.JS

Say you want to request a collection from the server in backbone.js, but don't want to receive every single item available.  Instead, you want to receive only the first 100 items.  Well, jQuery.ajax options can be passed directly as fetch options. docs

So, when you want to fetch the collection call the following:

instance_of_your_collection.fetch({data: {count: 100}});

If there are problems with the above, try parameterizing the data:

instance_of_your_collection.fetch({data: $.param({count: 100})});

On the server side, if you are using the Slim Framework with PHP, you can check the parameters like so:

$app->request()->params('count');

 

POSTED 2012-06-29 00:00:37 CATEGORY SOFTWARE TAGS JQUERY BACKBONEJS SLIM PHP
prev page
• • •
next page