Sha256: 563294fa70de6f0902ac04b13c5d8b89980d8b6446340b54da8e5df9a635b4c5

Contents?: true

Size: 831 Bytes

Versions: 13

Compression:

Stored size: 831 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 = function(json) {
    Jelly.notifyObservers(json);
    return true;
  };
})(jQuery);

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
honkster-jelly-0.7.4 generators/jelly/templates/javascripts/ajax_with_jelly.js
honkster-jelly-0.7.3 generators/jelly/templates/javascripts/ajax_with_jelly.js
honkster-jelly-0.7.2 generators/jelly/templates/javascripts/ajax_with_jelly.js
honkster-jelly-0.7.1 generators/jelly/templates/javascripts/ajax_with_jelly.js
honkster-jelly-0.7.0 generators/jelly/templates/javascripts/ajax_with_jelly.js
honkster-jelly-0.6.7 generators/jelly/templates/javascripts/ajax_with_jelly.js
honkster-jelly-0.6.6 generators/jelly/templates/javascripts/ajax_with_jelly.js
jelly-0.6.5 generators/jelly/templates/javascripts/ajax_with_jelly.js
btakita-jelly-0.6.1 generators/jelly/templates/javascripts/ajax_with_jelly.js
btakita-jelly-0.6.0 generators/jelly/templates/javascripts/ajax_with_jelly.js
jelly-0.5.9 generators/jelly/templates/javascripts/ajax_with_jelly.js
jelly-0.5.8 generators/jelly/templates/javascripts/ajax_with_jelly.js
jelly-0.5.7 generators/jelly/templates/javascripts/ajax_with_jelly.js