diff --git a/mithril.js b/mithril.js index a7e51cef..425c3fec 100644 --- a/mithril.js +++ b/mithril.js @@ -1113,7 +1113,7 @@ var m = (function app(window, undefined) { var isJSONP = xhrOptions.dataType && xhrOptions.dataType.toLowerCase() === "jsonp"; var serialize = xhrOptions.serialize = isJSONP ? identity : xhrOptions.serialize || JSON.stringify; var deserialize = xhrOptions.deserialize = isJSONP ? identity : xhrOptions.deserialize || JSON.parse; - var extract = xhrOptions.extract || function(xhr) { + var extract = isJSONP ? function(jsonp) {return jsonp.responseText} : xhrOptions.extract || function(xhr) { return xhr.responseText.length === 0 && deserialize === JSON.parse ? null : xhr.responseText }; xhrOptions.method = (xhrOptions.method || 'GET').toUpperCase();