jeffreyiacono/rack_csrf — comment on commit 76baa1ebb92a8bc9131489887b7f5338e6a37331
File:  line 0
By jeffreyiacono:

you can now use the jquery ajaxsetup setup a la rails again (in your sinatra app, for example):
```
(function(jQuery) {
// set the x-csrf-token for each ajax operation
// rack / rack_csrf handle the rest
$.ajaxSetup({
beforeSend: function(xhr) {
var token = jQuery('meta[name="csrf-token"]').attr('content');
xhr.setRequestHeader('X-CSRF-Token', token);
}
});
}(jQuery));
```
just make sure you include the csrf token in a meta tag in your layout's head