Skip to main content

Bug Tracker

Side navigation

#7421 closed bug (invalid)

Opened November 05, 2010 08:59PM UTC

Closed November 05, 2010 09:24PM UTC

Ajax, jQuery.get error!

Reported by: usname Owned by:
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:
Description

Hi, is was testing this. I use it inside fancybox, but outside fancybox it wouldn't work either. Any help?

jQuery.get(window.location, function(data){alert(data);});

This code is supposed to get the data of the current page, right? Actually it redirects me to some strange page (localhost/#.*$/)!?

Working testcase: http://jsfiddle.net/EsDf4/

You can see it doesn't work because there is NO alert!

Attachments (0)
Change History (2)

Changed November 05, 2010 09:08PM UTC by usname comment:1

http://jsfiddle.net/EsDf4/2/

Using Opera and IE bug does appear!

Changed November 05, 2010 09:24PM UTC by addyosmani comment:2

_comment0: The reason why you're seeing your page redirect is because you're using .get() (used to load data from a server) with the window.location value (ie the page itself). This would definitely not get you the data for the current page, unless you mean the data *output* of the URL. I'm not sure what form you want the data from the page to be in, but your question would be best handled in the jQuery Forums as this is not a bug with jQuery core.1288993843238979
resolution: → invalid
status: newclosed

The reason why you're seeing your page redirect is because you're using .get() (used to load data from a server) with the window.location value (ie the page itself). This would not get you the data for the current page, unless you mean the data *output* of the URL. I'm not sure what form you want the data from the page to be in, but your question would be best handled in the jQuery Forums as this is not a bug with jQuery core.