Sha256: 07f7498ff25e35b0755a77255456d593d8cb7936c3a46271eceba3c53dd2721b

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 Bytes

Contents

if(!window.Jelly) Jelly = new Object();

(Jelly.defineAjaxWithJellyFunctions = function($) {
  $.ajaxWithJelly = function(params) {
    $.ajax($.ajaxWithJelly.params(params));
  };

  if ($.fn.ajaxForm) {
    $.fn.ajaxFormWithJelly = function(params) {
      this.ajaxForm($.ajaxWithJelly.params(params));
    };
  }

  $.ajaxWithJelly.params = function(otherParams) {
    otherParams = otherParams || {};

    if (otherParams.type && otherParams.type != "GET") {
      otherParams['data'] = $.extend(otherParams['data'], {
        authenticity_token: window._token
      });
    }
    return $.extend({
      dataType: 'json',
      cache: false,
      success : Jelly.notifyObservers.bind(Jelly)
    }, otherParams);
  };
})(jQuery);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
honkster-jelly-0.7.5 generators/jelly/templates/javascripts/ajax_with_jelly.js