From 3dfa1ad4cec41036c2248c79ccbf3500dc6a4eda Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sat, 15 May 2010 17:16:52 +0200 Subject: [PATCH] Allow to set dataType with data-type HTML attribute --- src/rails.js | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rails.js b/src/rails.js index ac92340..17e140c 100644 --- a/src/rails.js +++ b/src/rails.js @@ -25,7 +25,8 @@ jQuery(function ($) { var el = this, data = el.is('form') ? el.serializeArray() : [], method = el.attr('method') || el.attr('data-method') || 'GET', - url = el.attr('action') || el.attr('href'); + url = el.attr('action') || el.attr('href'), + dataType= el.attr('data-type') || 'script'; if (url === undefined) { throw "No URL specified for remote call (action or href must be present)."; @@ -34,7 +35,7 @@ jQuery(function ($) { $.ajax({ url: url, data: data, - dataType: 'script', + dataType: dataType, type: method.toUpperCase(), beforeSend: function (xhr) { el.trigger('ajax:loading', xhr); -- 1.6.5.7