From 04eda65ee0c0c8cca971fccacaad9ee2bc7e27a4 Mon Sep 17 00:00:00 2001 From: Hakan Bruce Date: Mon, 11 Apr 2011 15:18:34 +0200 Subject: [PATCH] Updated fillFaceboxFromAjax to actually use $.ajax in order to get a nicer fallback when fetching fails. --- src/facebox.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/facebox.js b/src/facebox.js index 7d0e39d..b7a58c7 100644 --- a/src/facebox.js +++ b/src/facebox.js @@ -260,7 +260,19 @@ } function fillFaceboxFromAjax(href, klass) { - $.get(href, function(data) { $.facebox.reveal(data, klass) }) + $.ajax({ + type: "GET", + url: href, + success: function (data) { + $.facebox.reveal(data, klass) + }, + error: function (xhr, ajaxOptions, thrownError) { + data = 'Error: ' + xhr.statusText; + + $.facebox.reveal(data, klass) + return false + } + }) } function skipOverlay() {