/2012/06/29/How-to-send-URL-parameters-in-Backbone-js/
{"item":{"status":"visible","url":"\/2012\/06\/29\/How-to-send-URL-parameters-in-Backbone-js\/","trash":"","name":"How-to-send-URL-parameters-in-Backbone-js","parent":"","title":"How to send URL parameters in Backbone.js","date":"2012-06-29 00:00:37","filepath":"posts\/20120629_How-to-send-URL-parameters-in-Backbone-js.xml.json","type":"post","content":"<p><a href=\"http:\/\/backbonejs.org\/\"><img style=\"margin-left: 10px; margin-right: 10px; float: left;\" src=\"http:\/\/www.8bitrobot.com\/media\/uploads\/backbone-300x300.png\" alt=\"\" width=\"72\" \/><\/a>Say you want to request a collection from the server in <a href=\"http:\/\/backbonejs.org\/\">backbone.js<\/a>, but don't want to receive every single item available. Instead, you want to receive only the first 100 items. Well, <a href=\"http:\/\/api.jquery.com\/jQuery.ajax\/\">jQuery.ajax<\/a> options can be passed directly as fetch options. <sup><a href=\"http:\/\/backbonejs.org\/#Collection-fetch\">docs<\/a><\/sup><\/p>\n<p>So, when you want to fetch the collection call the following:<\/p>\n<pre style=\"padding-left: 30px;\">instance_of_your_collection.fetch({data: {count: 100}});<\/pre>\n<p>If there are problems with the above, try parameterizing the data:<\/p>\n<pre style=\"padding-left: 30px;\">instance_of_your_collection.fetch({data: $.param({count: 100})});<\/pre>\n<p>On the server side, if you are using the <a href=\"http:\/\/www.slimframework.com\">Slim Framework<\/a> with PHP, you can check the parameters like so:<\/p>\n<pre style=\"padding-left: 30px;\">$app->request()->params('count');<\/pre>\n<p> <\/p>"}}