I have this code: new Ajax.Request(url, { method: ''get'', onSuccess: function(transport) { var element = document.createElement("div"); Element.extend(element); element.innerHTML = transport.responseText; $(''content-title'').update(element.getElementsBySelector(''#title'') [0].innerHTML); $(''content-text'').update(element.getElementsBySelector(''#content'') [0].innerHTML); } } ); The file I''m loading looks like: <div id="title">...</div> <div id="content">...</div> and I want to set the content of "title" to div element "content- title" and content of "content" to "content-text". This code is working fine in FF, Opera, etc. but in IE6 and IE7 it does nothing. When I remove innerHTML and left only element.getElementsBySelector(''#*'')[0] it inserts some empty object. Can somebody help me how to solve this problem? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
1) Make sure you''re running the latest version (1.6) 2) I''m not sure how well IE handles selectors on uninserted elements so it would be safer to append it to the document first. $(document.body).insert(new Element(''div'', {id: ''_proxy''}).hide()); 3) Ajax.Updater is more appropriate when updating elements via ajax new Ajax.Updater(''_proxy'', url, { method: ''get'', onComplete: function() { $(''content-title'').update($(''_proxy'').down(''#title'').innerHTML); $(''content-text'').update($(''_proxy'').down(''#content'').innerHTML); } }) 4) It would be more convenient if your server could return JSON instead of an html {"title": "foo", "content": "bar"}. The above snippet would only take few lines: new Ajax.Request(url, { method: ''get'', onSuccess: function(resp) { var data = resp.responseJSON; $(''content-title'').update(data.title); $(''content-text'').update(data.content) } }) Best, kangax --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks, the 2nd point was the problem. And also thanks for tips. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
The responseJSON is null (and json in function parameter was null too). Can you tell me why? Anyway I''ve used responseText.evalJSON(). --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
JSON responses must have a Content-type header of application/json --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---