On Jan 27, 2008 5:04 PM, Jean-Philippe Encausse <[EMAIL PROTECTED]> wrote:
> > Thanks for your answer > > > dynamically creating a <script> tag and inserting > > it into the dom to create functionality once the page has been loaded on > > the client system? > > Yes exactly, I'm try to include the script of MyBlogLog that should be: > <script src="http://pub.mybloglog.com/comm2.php?mblID=2006121510341039" > type="text/javascript"></script> > The url is longer normally and it works. > > > When requesting from browser: > http://pub.mybloglog.com/comm2.php?mblID=2006121510341039 > This will return a script that generate <table> > > So I try: > > Event.observe(window, 'load', function() { > // Using 'static' object > JCMS.plugin.mybloglog.MyBlogLog.insertScript(); > }); > > Then I'm using a <a href="mybloglog url"></a> to retrieve the location > and url to call > > JCMS.plugin.mybloglog.MyBlogLog = { > > insertScript : function () { > var elm = $('MyBlogLog'); > > var url = elm.href; > var address = url.substring(0,url.indexOf('?')); > var params = $H(url.toQueryParams()); > > /* Option 1 > var script = document.createElement('SCRIPT'); > script.type='text/javascript'; > script.src = address+"?"+params.toQueryString(); > elm.parentNode.appendChild(script); > */ > > /* Option 2 > // elm.parentNode.innerHTML = "<script type='text/javascript' > src='"+address+"?"+params.toQueryString()+"'></script>" > */ > > /* Option 3 > new Ajax.Updater(elm.parentNode, address, { > parameters: { > mblID: '2006121510341039', > } > */ > }); > } > }; > > > - I don't know what is the best way to do it ? > - I do not want to directly write the <script> tag in the page because > it may slow down the page loading. > - How can I have the response code from the Ajax request ? > - Should I set a userAgent ? im not sure why you want to retrieve the remote script once the page has loaded. why dont you just include <script src="http://pub.mybloglog.com/comm2.php?mblID=2006121510341039" type="text/javascript"></script> in the server side code that produces the page? -nathan --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
