2009/6/18 jacktanner <i...@hotmail.com>:
>
> I'm trying to do an AJAX GET.
>
>            var q_url = window.location.toString();
>            $.ajax({
>                type: 'GET',
>                        url: q_url,
>                        cache: false,
>                        dataType: 'json',
>                        success: function(response, textStatus) { ... },
>                        error: function (xhr, textStatus, errorThrown) {
>                          alert(textStatus);
>                        }
>            });
>
> This triggers the error callback with textStatus == "parseerror".

You're specifying a dataType of "json", yet you're GETting the
original HTML page in which this code is running (window.location). As
HTML is not JSON, you should _expect_ a parse error.

Regards,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/

Reply via email to