[jQuery] Re: Repeatable problem with Firefox 3 and AJAX

2009-09-10 Thread candlerb
OK, problem solved sufficiently for now. (1) The workaround is to set $.ajaxSetup({ cache: false }); Then ?_= is added to each AJAX request, so a new request hits the server each time. As it's a fresh XHR request, I'm not getting the wrong "HTML" (non-XHR) version of the page inserted. This i

[jQuery] Re: Repeatable problem with Firefox 3 and AJAX

2009-09-10 Thread candlerb
Additional data point: if I modify the page to replace jQuery with native Javascript+DOM, the problem goes away. This seems to be because hitting the 'back' button reverts straight to the previous page as it was (complete with its AJAX updates), rather than refreshing the original HTML and then re

[jQuery] Repeatable problem with Firefox 3 and AJAX

2009-09-10 Thread candlerb
I have found a problem with Firefox 3 and AJAX, and give code to replicate it below. The problem is when you have a resource, e.g. /docs/1234, which is fetched both directly as a web page and as AJAX (XMLHttpRequest). The server detects these cases based on the X-Requested-With: XMLHttpRequest he

[jQuery] Re: Animating show() and hide() of TBODY

2009-09-03 Thread candlerb
Ticket http://dev.jquery.com/ticket/5157

[jQuery] Re: Animating show() and hide() of TBODY

2009-09-03 Thread candlerb
I have made a frig which solves this, by applying display: table-row- group instead of display: block for TBODY elements. There's a slight "bounce" when unhiding (Firefox 3.0.13) - seems the height goes a few pixels to far - but otherwise it seems OK. I doubt this hard-coded logic is the right wa

[jQuery] Re: Animating show() and hide() of TBODY

2009-09-03 Thread candlerb
Here's a page which demonstrates the problem; hiding and showing tbody#middle makes it jump to the end of the page as it gets display: block. It works if you set anim_speed to 0 (but then it's not animated, of course) Test animate of tbody jQuery( function($) { var anim_speed = 250; var t

[jQuery] Animating show() and hide() of TBODY

2009-09-02 Thread candlerb
I am writing some code where I want to insert and subsequently hide a TBODY element within a table, and animate it doing so. Unfortunately, if I do hide() followed by show(250), say, then the element becomes and this results in the inserted section displaying after the end of the table :-(

[jQuery] Re: Detecting a redirect response to an Ajax query

2009-07-17 Thread candlerb
Many thanks for your input - this is now working perfectly. For the benefit of the archives: - In the server, where the session expiry is detected, I check for XMLHttpRequest ("request.xhr?" in Rails) - If so, I send back a 403 instead of the redirect to the login page - At the client side, I hav

[jQuery] Re: Detecting a redirect response to an Ajax query

2009-07-15 Thread candlerb
My complete() callback looks like this: complete: function(res, status) { if ( status == "success" || status == "notmodified" ) { node.replaceWith(res.responseText); } else { // Error handling here } } The login page gets inserted i

[jQuery] Detecting a redirect response to an Ajax query

2009-07-15 Thread candlerb
Is there any way to be able to detect in $.ajax whether the response involved a HTTP redirect? My backend application times out sessions, and if the next request comes in after the session has timed out, it redirects the user to / signup/login. Unfortunately, if this happens when the client issue

[jQuery] Re: Function to parse query string from URL?

2009-07-06 Thread candlerb
> http://plugins.jquery.com/project/parseQuery Perfect, thank you!

[jQuery] Function to parse query string from URL?

2009-07-05 Thread candlerb
Hello, a quick question in case I'm being stupid :-) I see that jQuery provides a function to turn an object into a set of URL query parameters: $.param({foo:"xxx", bar:"yyy"}) => "foo=xxx&bar=yyy" My question is: is there a function which does the opposite, i.e. parsing a query string into

[jQuery] Re: Prototype to jQuery: "current" element

2009-01-24 Thread candlerb
I found the solution. Whilst jRails uses jquery-ui-1.5, it is still using jquery-1.2.6, and "closest" is a 1.3 feature. The following works just fine: remove Ricardo Tomasi wrote: > 'this' in an attribute event handler refers to 'window', not the > element itself. In my copy of JavaScript,

[jQuery] Prototype to jQuery: "current" element

2009-01-23 Thread candlerb
I am trying to convert the following Prototype code to jQuery: ... remove Basically, when a user clicks on the 'remove' link I want the entire enclosing div which contains this link to vanish from the DOM. But there are multiple divs, each with their own 'remove' links. (*) With jQuery I