Sha256: dbe9b7658fe29478de8a402a5e90401a0d7fa595146cfb2d878a1f27e45aa506
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
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) { var context = json.on ? eval(json.on) : page; if(context[json.method]) { context[json.method].apply(context, json.arguments); } $.protify(page.components).each(function(componentAndArgs) { var component = componentAndArgs[0]; if(component[json.method]) { component[json.method].apply(component, json.arguments); } }); return true; }; })(jQuery);
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jelly-0.5.5 | generators/jelly/templates/javascripts/ajax_with_jelly.js |