Sha256: 69ba11b6e50d72af19df2d3bb9d9770d9a2da2f4edafb08fa69022e9374abc57

Contents?: true

Size: 829 Bytes

Versions: 4

Compression:

Stored size: 829 Bytes

Contents

if(!window.Jelly) window.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 : function(callbacks) {
        Jelly.Observers.notify.call(otherParams.observers || Jelly.observers, callbacks);
      }
    }, otherParams);
  };
})(jQuery);

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
honkster-jelly-0.9.3 generators/jelly/templates/javascripts/ajax_with_jelly.js
honkster-jelly-0.9.2 generators/jelly/templates/javascripts/ajax_with_jelly.js
honkster-jelly-0.9.1 generators/jelly/templates/javascripts/ajax_with_jelly.js
honkster-jelly-0.9.0 generators/jelly/templates/javascripts/ajax_with_jelly.js