Bug Tracker

Opened 5 years ago

Closed 5 years ago

#7421 closed bug (invalid)

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!

Change History (2)

comment:1 Changed 5 years ago by usname

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

Using Opera and IE bug does appear!

comment:2 Changed 5 years ago by addyosmani

  • Resolution set to invalid
  • Status changed from new to closed

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.

Last edited 5 years ago by addyosmani (previous) (diff)
Note: See TracTickets for help on using tickets.