diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-08-03 11:10:13 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-08-03 11:10:13 -0700 |
commit | 42617117c01527ae24dfaa7d3388baefe11f01c5 (patch) | |
tree | 0bb85c1a11bb9236063d30bdc7df66d86c9925cb | |
parent | 3492f1712dd21511347c96a463504eb5ac912681 (diff) |
Replace overlooked 'form' parameter in json response with 'html'.
-rw-r--r-- | lib/gallery.dialog.js | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js index f1d146ab..450f4c88 100644 --- a/lib/gallery.dialog.js +++ b/lib/gallery.dialog.js @@ -32,7 +32,7 @@ type: "GET", beforeSend: function(xhr) { // Until we convert to jquery 1.4, we need to save the XMLHttpRequest object so that we - // can detect the mime type of the reply + // can detect the mime type of the reply this.xhrData = xhr; }, success: function(data, textStatus, xhr) { @@ -45,7 +45,7 @@ var content = ""; if (mimeType[1] == "application/json") { data = JSON.parse(data); - content = unescape(data.form); + content = unescape(data.html); } else { content = data; } @@ -130,31 +130,31 @@ }, beforeSend: function(xhr) { // Until we convert to jquery 1.4, we need to save the XMLHttpRequest object so that we - // can detect the mime type of the reply + // can detect the mime type of the reply this.xhrData = xhr; }, success: function(data) { // Pre jquery 1.4, get the saved XMLHttpRequest object xhr = this.xhrData; - if (xhr) { - var mimeType = /^(\w+\/\w+)\;?/.exec(xhr.getResponseHeader("Content-Type")); - - var content = ""; - if (mimeType[1] == "application/json") { - data = JSON.parse(data); - } else { - data = {"html": escape(data)}; - } - } else { - // Uploading files (eg: watermark) uses a fake xhr in jquery.form.js so - // all we have is in the data field, which should be some very simple JSON. - // Weirdly enough in Chrome the result gets wrapped in a <pre> element and - // looks like this: - // <pre style="word-wrap: break-word; white-space: pre-wrap;">{"result":"success", - // "location":"\/~bharat\/gallery3\/index.php\/admin\/watermarks"}</pre> - // bizarre. Strip that off before parsing. - data = JSON.parse(data.match("({.*})")[0]); - } + if (xhr) { + var mimeType = /^(\w+\/\w+)\;?/.exec(xhr.getResponseHeader("Content-Type")); + + var content = ""; + if (mimeType[1] == "application/json") { + data = JSON.parse(data); + } else { + data = {"html": escape(data)}; + } + } else { + // Uploading files (eg: watermark) uses a fake xhr in jquery.form.js so + // all we have is in the data field, which should be some very simple JSON. + // Weirdly enough in Chrome the result gets wrapped in a <pre> element and + // looks like this: + // <pre style="word-wrap: break-word; white-space: pre-wrap;">{"result":"success", + // "location":"\/~bharat\/gallery3\/index.php\/admin\/watermarks"}</pre> + // bizarre. Strip that off before parsing. + data = JSON.parse(data.match("({.*})")[0]); + } if (data.html) { $("#g-dialog").html(unescape(data.html)); |