Popup Window Problem AJAX

When I try to use Ajax in a window openened by ‘window.open(’’);’
it doesn’t work. There is no exceptions raised as far as I can see
(debugging with FireBug).

However, if I refresh the window once it has popped up it does work. Is
there something I’m missing?

Code in my popup window:

Image Browser <%= javascript_include_tag '/admin/javascripts/prototype.js' %> Search: //<![CDATA[ new Form.Element.Observer( 'search', 0.5, function(element, value) { new Ajax.Updater( 'items', '/admin/browser/items?item_type=ImageAsset', { asynchronous: true, evalScripts: true, parameters: 'search=' + escape(value) } ) }); //]]> </script> <div id="items"></div> </body> </html> ------------------------------------------------------------ <p>Many Thanks,<br> Mark</p>

Mark D. wrote:

When I try to use Ajax in a window openened by ‘window.open(’‘);’
it doesn’t work. There is no exceptions raised as far as I can see
(debugging with FireBug).

However, if I refresh the window once it has popped up it does work. Is
there something I’m missing?

You might do better to ask JavaScript questions on a JavaScript mailing
list.


James B.

http://beginningruby.com - Beginning Ruby: The Online Book
Ruby Code & Style - The Journal By & For Rubyists
http://www.rubystuff.com - The Ruby Store for Ruby Stuff

Sorry I don’t have time to mock this up and test my idea. Try moving

//<![CDATA[ new Form.Element.Observer( 'search', 0.5, function(element, value) { new Ajax.Updater( 'items', '/admin/browser/items?item_type=ImageAsset', { asynchronous: true, evalScripts: true, parameters: 'search=' + escape(value) } ) }); //]]> below <div id="items"></div> Sbecker

Thanks, but that doesn’t help.

Is it something to do with a security issue that popup windows can’t
make Ajax requests maybe? This is really annoying me!

Ta, Mark

If it works after you refresh the popup window then its not a security
issue.

If you pull the ajax call out of the form observer, does it send a
message to the server when the page loads?

Sbecker