Bug Tracker

Modify

Ticket #2227 (closed bug: invalid)

Opened 5 years ago

Last modified 3 years ago

ajaxForm() with dataType script does not handle redirect well

Reported by: khelenek Owned by:
Priority: minor Milestone: 1.2.2
Component: ajax Version: 1.2.2
Keywords: Cc:
Blocking: Blocked by:

Description

I added a post here:http://groups.google.com/group/jquery-en/browse_thread/thread/ef70736d93ffac90/d09bf726c2c4ccca?lnk=gst&q=ajax+redirect#d09bf726c2c4ccca

  1. Create a form
  2. Use the jquery forms plugin, do $('myform').ajaxForm({dataType:'script'});
  3. Sumbit the form
  4. Have you server return "window.location.href='jquery.com';"
  5. Watch the page redirect
  6. Press back button, you go back to the page *before* step 1.

The equivalent code using prototype works as expected (the browser back button returns you to the original page with the form.)

Windows XP Firefox 2.0.0.11/IE7

Change History

comment:1 Changed 5 years ago by khelenek

OK, dug into this a little deeper and it appears to be a side effect of the new globalEval() function based on andrea giammarchi's code, where a script tag is added to the node instead of using the eval() function.

To see this behavior, just go into firebug and load any page which includes jquery, and type this into the console:

$.globalEval('window.location.href=" http://jquery.com"');

and you will see the history get erased. Compare to:

eval('window.location.href=" http://jquery.com"');

This is kind of a dealbreaker for me since I use that functionality currently. A workaround would be great - a fix or promise of a future fix would be excellent.

comment:2 Changed 5 years ago by flesler

  • need changed from Review to Patch
  • Priority changed from major to minor

comment:3 Changed 3 years ago by dmethvin

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

ajaxForm is a plugin and not part of jQuery core.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.