Sha256: ee2ed02984d7fbffe445e52120354619fc5f1ec5848ab3dee856b3bec8a1fc6c

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 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 : $.ajaxWithJelly.onSuccess
    }, otherParams);
  };

  $.ajaxWithJelly.onSuccess = Jelly.notifyObservers.bind(Jelly);
})(jQuery);

Version data entries

2 entries across 2 versions & 1 rubygems

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