When I hardcode q_url, I use a relative path. I tried window.location.href (absolute path) and window.location.pathname (relative path), and both of those give a parseerror. By the way, this is jquery 1.3.2.
Thank you for explaning cache:false! On Jun 18, 2:04 pm, James <james.gp....@gmail.com> wrote: > When you hardcode q_url, do you also put in the absolute path? > (e.g.http://www.balh.com/myscript.php) or only the relative path? (e.g. > myscript.php) > > The _=1234567889 part is a result of using 'cache:false'. This gives > the URL a unique value every time so that a server request is always > done. > > On Jun 17, 6:20 pm, jacktanner <i...@hotmail.com> wrote: > > > 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". If I > > hardcode q_url, everything works. Stepping through with Firebug shows > > that q_url has the same value no matter if it's hardcoded or set via > > window.location.toString() (or window.location.href or > > window.location.pathname, which are all supposed to be strings > > according tohttps://developer.mozilla.org/En/DOM/Window.location). > > The browser is Firefox 3.0.11. Any ideas? > > > A separate issue is that no matter whether the GET succeeds or fails, > > instead of going to q_url, it goes to a url like q_url + '? > > _=1245297612818' (according to Firebug 1.3). What gives?