| Thanks man!!!! Great tip! |
| by Zeljko(//don't have one) at 21 Aug 2007 09:55:28
|
|
AJAX calls from popups do not work on Firefox
back
Previous article:
That AJAX pitfall in the quest for interaction
view
Another day, another problem with Firefox ! There was a time when I thought Firefox was the best thing since slice bread, but it sounds like it has its own problems like any other browser. Last time it was the crash caused by embedded inplace-editors in an AJAX response, this time things are not that servere, but are related to the same problem. As I can not embed, my work around is to pop up the editor so it can be separated from the DOM element receiving the AJAX response. No, I can not put the inplace-editor elsewhere on the page either because it is context sensitive to the contents coming back from the AJAX call, and embedding it elsewhere on the page will require the URL to be static.
Anyway, the problem I had was that I could not get the DOM element which contains the AJAX contents to be refreshed from the popup once the data has been entered (this works flawlessly in IE). Let's say I have this piece of code on the main page:
<script> function refresh_foo() { new Ajax.Updater('foo', '/mypage/list'), {asynchronous:true, evalScripts:true}); } </script> <div id='foo'> </div>
Then calling refresh_foo() on the page should fill the foo element with the data from the /mypage/list call. However, if I want to call the refresh_foo() function from a popup window using window.open() i.e. window.opener.refresh_foo(), then the foo element on the main browser window does not get refreshed at all in Firefox.
Not sure what the problem is. However, currently the workaround, which is a one liner, overcomes this problem. Maybe Mozilla will get around to fixing it one day, but as far as I know, this is a problem in even the latest version of Firefox, namely 1.5.x.
Oh, and the fix is to change the call above to:
<script> window.opener.setTimeout("refresh_foo()", 100); </script>
in your popup window.
back
Previous article:
That AJAX pitfall in the quest for interaction
view
(1 comment)
by by David at 18 Jun 2006 15:55:19
|
|