diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-08-01 10:35:15 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-08-01 10:35:15 -0700 |
commit | 3b187d7fe9acbe46e38ae824b6374dd3bfd0cfb0 (patch) | |
tree | 81af4ec2993f740fb632c9f5ea4572bb2d1efa23 /lib/gallery.panel.js | |
parent | 563afbe6ddf4b4debea87a0cb0b8758c8826f80c (diff) | |
parent | bf7115cf5a732cea2d498971ec94d2ade3b2fcdd (diff) |
Merge branch 'dialog'
Diffstat (limited to 'lib/gallery.panel.js')
-rw-r--r-- | lib/gallery.panel.js | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/lib/gallery.panel.js b/lib/gallery.panel.js index b94df223..e0605ca3 100644 --- a/lib/gallery.panel.js +++ b/lib/gallery.panel.js @@ -31,15 +31,37 @@ if (should_open) { $(parent).after(ePanel); $("#g-panel td").html(sHref); - $.getJSON(sHref, function(data) { - $("#g-panel td").html(unescape(data.form)); - self._ajaxify_panel(); - if ($(element).attr("open_text")) { - $(element).attr("orig_text", $(element).children(".g-button-text").text()); - $(element).children(".g-button-text").text($(element).attr("open_text")); + $.ajax({ + url: sHref, + type: "GET", + beforeSend: function(xhr) { + // Until we convert to jquery 1.4, we need to save the + // XMLHttpRequest object + this.xhrData = xhr; + }, + success: function(data, textStatus, xhr) { + // Pre jquery 1.4, get the saved XMLHttpRequest object + if (xhr == undefined) { + xhr = this.xhrData; + } + var mimeType = /^(\w+\/\w+)\;?/.exec(xhr.getResponseHeader("Content-Type")); + var content = ""; + if (mimeType[1] == "application/json") { + data = JSON.parse(data); + content = unescape(data.html); + } else { + content = data; + } + + $("#g-panel td").html(content); + self._ajaxify_panel(); + if ($(element).attr("open_text")) { + $(element).attr("orig_text", $(element).children(".g-button-text").text()); + $(element).children(".g-button-text").text($(element).attr("open_text")); + } + $("#g-panel").addClass(parentClass).show().slideDown("slow"); } - $("#g-panel").addClass(parentClass).show().slideDown("slow"); - }); + }); } return false; @@ -57,8 +79,8 @@ return true; }, success: function(data) { - if (data.form) { - $("#g-panel td form").replaceWith(data.form); + if (data.html) { + $("#g-panel td").html(data.html); self._ajaxify_panel(); } if (data.result == "success") { |