Sha256: 26ba156f0034d2c31b6157d881e5a7d258779510f83f49a1fed0aa44df32829e

Contents?: true

Size: 712 Bytes

Versions: 7

Compression:

Stored size: 712 Bytes

Contents

// Ensures AJAX requests are properly formated so that Rails knows how to respond to them.
$.ajaxSetup({
  beforeSend: function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
});

/* Ensures AJAX requests have the proper Rails authenticity token.  See the following
   for more info:

   http://henrik.nyh.se/2008/05/rails-authenticity-token-with-jquery
   http://dev.jquery.com/ticket/3387
*/
$(document).ajaxSend(function(event, request, settings){
  var authToken = "<%= form_authenticity_token %>";
  if (authToken != null){
    settings.data = settings.data || "";
    settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(authToken);
  };
});

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
aeonscope-btech_rest-0.4.1 rails_generators/rest_setup/templates/app/views/javascripts/ujs.js.erb
aeonscope-btech_rest-0.4.2 rails_generators/rest_setup/templates/app/views/javascripts/ujs.js.erb
aeonscope-btech_rest-0.4.4 rails_generators/rest_setup/templates/app/views/javascripts/ujs.js.erb
aeonscope-btech_rest-0.5.0 rails_generators/ujs_setup/templates/app/views/javascripts/ujs.js.erb
aeonscope-btech_rest-0.5.2 rails_generators/ujs_setup/templates/app/views/javascripts/ujs.js.erb
aeonscope-btech_rest-0.5.3 rails_generators/ujs_setup/templates/app/views/javascripts/ujs.js.erb
aeonscope-rest-1.0.0 rails_generators/ujs_setup/templates/app/views/javascripts/ujs.js.erb