I am trying to get a system where a client includes one or two lines of Javascript in his page, and that code will grab dynamic data from my server and display it inline on his page. My code for the JS to include on the clients page is something like this: <script type="text/javascript">var id="12345";</script> <script type="text/javascript" src="http://my.site.url/grabData.js"></ script> I then want to take that id, grab data from an SQL database, and print it back to the clients page inline... but I dont know how to connect to SQL using Javascript... anybody help? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Matt Harris
2007-Aug-24 04:35 UTC
Re: Using Javascript to display information on clients page
Why not <script type="text/javascript" src="http://yoursite.url/grabData.php?id=12345"></script> And serve up the content via php*.... better yet, why even do a <script> include? * Replace PHP here with your server side language of choice. On 8/23/07, junkmate <junkmate-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I am trying to get a system where a client includes one or two lines > of Javascript in his page, and that code will grab dynamic data from > my server and display it inline on his page. > > My code for the JS to include on the clients page is something like > this: > <script type="text/javascript">var id="12345";</script> > <script type="text/javascript" src="http://my.site.url/grabData.js"></ > script> > > I then want to take that id, grab data from an SQL database, and print > it back to the clients page inline... but I dont know how to connect > to SQL using Javascript... anybody help? > > > > >-- Matt Harris (250)-588-2275 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
junkmate
2007-Aug-24 20:41 UTC
Re: Using Javascript to display information on clients page
<script type="text/javascript" src="http://yoursite.url/grabData.php?id=12345"></script> yer I tried that... it didnt work. PHP doesnt have the ''document.write'' functionality that JS has... or something, I forget the reason. I got it working in the end by using a JS script that calls an AJAX function which calls PHP :D A long way around perhaps, but it works... On Aug 24, 5:35 am, "Matt Harris" <harri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Why not > <script type="text/javascript" > src="http://yoursite.url/grabData.php?id=12345"></script> > > And serve up the content via php*.... better yet, why even do a > <script> include? > > * Replace PHP here with your server side language of choice. > > On 8/23/07, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > I am trying to get a system where a client includes one or two lines > > of Javascript in his page, and that code will grab dynamic data from > > my server and display it inline on his page. > > > My code for the JS to include on the clients page is something like > > this: > > <script type="text/javascript">var id="12345";</script> > > <script type="text/javascript" src="http://my.site.url/grabData.js"></ > > script> > > > I then want to take that id, grab data from an SQL database, and print > > it back to the clients page inline... but I dont know how to connect > > to SQL using Javascript... anybody help? > > -- > Matt Harris > (250)-588-2275--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
junkmate
2007-Aug-25 00:45 UTC
Re: Using Javascript to display information on clients page
ok it turns out my method doesnt work after all :( after I got everything else working aswell... annoying :S Matt Harris - the reason I have to use <script> is that not all people use PHP. I want my content to be compatible with any page type, as clients will be including it on their pages (html, php, asp, etc.) and Javascript is more compatible in this respect. On Aug 24, 9:41 pm, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <script type="text/javascript" > src="http://yoursite.url/grabData.php?id=12345"></script> > yer I tried that... it didnt work. > PHP doesnt have the ''document.write'' functionality that JS has... or > something, I forget the reason. > > I got it working in the end by using a JS script that calls an AJAX > function which calls PHP :D > A long way around perhaps, but it works... > > On Aug 24, 5:35 am, "Matt Harris" <harri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Why not > > <script type="text/javascript" > > src="http://yoursite.url/grabData.php?id=12345"></script> > > > And serve up the content via php*.... better yet, why even do a > > <script> include? > > > * Replace PHP here with your server side language of choice. > > > On 8/23/07, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I am trying to get a system where a client includes one or two lines > > > of Javascript in his page, and that code will grab dynamic data from > > > my server and display it inline on his page. > > > > My code for the JS to include on the clients page is something like > > > this: > > > <script type="text/javascript">var id="12345";</script> > > > <script type="text/javascript" src="http://my.site.url/grabData.js"></ > > > script> > > > > I then want to take that id, grab data from an SQL database, and print > > > it back to the clients page inline... but I dont know how to connect > > > to SQL using Javascript... anybody help? > > > -- > > Matt Harris > > (250)-588-2275--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
junkmate
2007-Aug-25 04:32 UTC
Re: Using Javascript to display information on clients page
Matt, apologies... what you suggested worked... I need the <script> however since data is passed via javascript, using something like this: <?php echo "document.write(''hello'');"; ?> Thanks for your help On Aug 25, 1:45 am, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> ok it turns out my method doesnt work after all :( > after I got everything else working aswell... annoying :S > > Matt Harris - the reason I have to use <script> is that not all people > use PHP. I want my content to be compatible with any page type, as > clients will be including it on their pages (html, php, asp, etc.) and > Javascript is more compatible in this respect. > > On Aug 24, 9:41 pm, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > <script type="text/javascript" > > src="http://yoursite.url/grabData.php?id=12345"></script> > > yer I tried that... it didnt work. > > PHP doesnt have the ''document.write'' functionality that JS has... or > > something, I forget the reason. > > > I got it working in the end by using a JS script that calls an AJAX > > function which calls PHP :D > > A long way around perhaps, but it works... > > > On Aug 24, 5:35 am, "Matt Harris" <harri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Why not > > > <script type="text/javascript" > > > src="http://yoursite.url/grabData.php?id=12345"></script> > > > > And serve up the content via php*.... better yet, why even do a > > > <script> include? > > > > * Replace PHP here with your server side language of choice. > > > > On 8/23/07, junkmate <junkm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I am trying to get a system where a client includes one or two lines > > > > of Javascript in his page, and that code will grab dynamic data from > > > > my server and display it inline on his page. > > > > > My code for the JS to include on the clients page is something like > > > > this: > > > > <script type="text/javascript">var id="12345";</script> > > > > <script type="text/javascript" src="http://my.site.url/grabData.js"></ > > > > script> > > > > > I then want to take that id, grab data from an SQL database, and print > > > > it back to the clients page inline... but I dont know how to connect > > > > to SQL using Javascript... anybody help? > > > > -- > > > Matt Harris > > > (250)-588-2275--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---