Bug Tracker

Ticket #7421 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

Ajax, jQuery.get error!

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

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

comment:1 Changed 4 years ago by usname

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

Using Opera and IE bug does appear!

comment:2 Changed 4 years ago by addyosmani

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

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 4 years ago by addyosmani (previous) (diff)
Note: See TracTickets for help on using tickets.