Sha256: 46d9eb3e2ab8047d2fc05500a2b32b3ab6aef9814a207bf68c83134d1ba4c127

Contents?: true

Size: 713 Bytes

Versions: 1

Compression:

Stored size: 713 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

1 entries across 1 versions & 1 rubygems

Version Path
aeonscope-rest-1.1.0 rails_generators/rest_setup/templates/app/views/javascripts/ujs.js.erb