From 71643e9af6682b8b626257d2a907594a57fc4a66 Mon Sep 17 00:00:00 2001 From: Bob Remeika Date: Wed, 14 Jul 2010 18:05:35 +0000 Subject: [PATCH] Fix for requesting remote data with the correct data type format git-svn-id: http://svn.dojotoolkit.org/src/dojox/trunk@22476 560b804f-0ae3-0310-86f3-f6aa0a117693 --- rails.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/rails.js b/rails.js index 114a28faee..0af14f149d 100644 --- a/rails.js +++ b/rails.js @@ -52,6 +52,15 @@ dojo.ready((function(d, dr, dg){ }); }; + var typeMap = { + "text": "text", + "json": "application/json", + "json-comment-optional": "text", + "json-comment-filtered": "text", + "javascript": "application/javascript", + "xml": "text/xml" + }; + var handleRemote = function(evt){ var el = evt.target, tag = el.tagName.toLowerCase(); var content = tag.toLowerCase() == "form" ? d.formToObject(el) : {}, @@ -65,11 +74,12 @@ dojo.ready((function(d, dr, dg){ } evt.preventDefault(); + // ajax:loading, ajax:loaded, and ajax:interactive are not supported d.publish("ajax:before", [el]); var deferred = d.xhr(method, { url: url, - headers: { "Accept": type == "text" ? "text" : "text/"+type }, + headers: { "Accept": typeMap[type] }, content: content, handleAs: type, load: function(response, ioArgs) {d.publish("ajax:success", [el, response, ioArgs]);},