Sha256: e3b3d2d62e379c829d8ff42a0db77ca4fc41ac44c485c414cd24b6551f32414d

Contents?: true

Size: 697 Bytes

Versions: 5

Compression:

Stored size: 697 Bytes

Contents

(function($) {
  $.ajaxWithJelly = function(params) {
    $.ajax($.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) {
    var context = json.on ? eval(json.on) : page;
    context[json.method].apply(context, json.arguments);
    return true;
  };
})(jQuery);

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
honkster-honkster-jelly-0.3.0 generators/jelly/templates/javascripts/ajax_with_jelly.js
pivotal-honkster-jelly-0.3.0 generators/jelly/templates/javascripts/ajax_with_jelly.js
pivotal-jelly-0.3.1 generators/jelly/templates/javascripts/ajax_with_jelly.js
pivotal-jelly-0.3.5 generators/jelly/templates/javascripts/ajax_with_jelly.js
pivotal-jelly-0.4.0 generators/jelly/templates/javascripts/ajax_with_jelly.js