Hi, I am facing a problem and the description is as follows - I have a page 1.html that does an Ajax.Updator & calls stuff from 2.html (that has some html snippet & some javascript). So far so good - things work fine. However, if 2.html had any document.write code - eg document.write(''hello'') then once the response is received it will be rendered till the point document.write is encountered and after that it will write to a new document instead of writing to the same one. I know this is how document.write is supposed to work. But, does anyone know about a workaround such that I don''t have to change my document.writes in the legacy code and still get this to work with Ajax? Let me know. Thanks, Mandy.
On 3/22/06, Maninder, Singh <mandiv-W2hqgAdRMsX2eFz/2MeuCQ@public.gmane.org> wrote:> response is received it will be rendered till the point document.write is encountered and after that it will write to a new document instead of writing to the same one. I know this is how document.write is supposed to work. > > But, does anyone know about a workaround such that I don''t have to change my document.writes in the legacy code and still get this to work with Ajax?Redefine document.write before the ajax call. document.write = function(text) { alert(text); // or whatever } Bye, Martin
Martin - This is my server response - **cript> page="from ajax"; document.write(''test''); <**cript> <div> Test </div> I am not able to follow what you suggested. Could you take this example and explain? Thanks in advance, Mandy. _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
On 3/22/06, Maninder, Singh <mandiv-W2hqgAdRMsX2eFz/2MeuCQ@public.gmane.org> wrote:> I am not able to follow what you suggested. > > Could you take this example and explain?There is nothing special with document.write. It can be redeclared like any normal property. Just try this in normal page: document.write("written"); // Gets written to screen document.write = function(text){ alert(text) } document.write("also written?"); // No, the text is shown in an alert. So just do a document.write = Prototype.emptyFunction; if you want to send calls to document.write to /dev/null Bye, Martin