Sha256: 190f37398d52197aa7934bf0c9c2f31599a0f77c4c45c3ca714896bebad70396

Contents?: true

Size: 634 Bytes

Versions: 1

Compression:

Stored size: 634 Bytes

Contents

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

  $.ajaxWithJelly.params = function(otherParams) {
    otherParams = otherParams || {};
    otherParams['data'] = $.extend(otherParams['data'], {
      authenticity_token: _token
    });
    return $.extend({
      dataType: 'json',
      cache: false,
      type: 'POST',
      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

1 entries across 1 versions & 1 rubygems

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