I didn't have to do that for now, but if I had to I'd use Firebug to inspect
XMLHttpRequest in the dom view and see if there's an url, target, or
location property or method that returns something looking like said url.
Once you've installed Firebug (which is a great tool to debug JavaScript
(especially AJAX, but also html, css, etc)) you can add to your error
callback :

console.log(XMLHttpRequest);

This will output in Firebug's console the content of XMLHttpRequest. You can
then right-click on it and select "view in DOM tab" in the contextual menu.
You'll get the view you need to inspect it "from the inside" and find what
you need.

Hope this helps.

Michel Belleville


2009/11/10 paul s <pksole...@gmail.com>

> Hi folks,
>
> Is it possible to retrieve the URL used in a getJSON call in a generic
> ajax error handler?
>
> I do the following:
>
> jQuery.ajaxSetup({ error: showAjaxError });
>
> with the function being:
>
> function showAjaxError(XMLHttpRequest, textStatus, errorThrown) {}
>
> ...and all our calls use getJSON i.e.
>
> jQuery.getJSON("/resources/javascript/gettingstarted.json", function
> (data) {}
>
> But I can't figure out how to get the requested URL in the ajax error
> function?
>
> Is it possible?
>
> Many thanks!
> Paul.
>

Reply via email to