Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 29th August 2007, 15:44
badben badben is offline
Senior Member
 
Join Date: Oct 2005
Location: Lancashire, UK
Posts: 103
Thanks: 0
Thanked 2 Times in 2 Posts
Default passing variables to a javascript file using php

I am trying to create a google maps application in php whereby a load of points appear on a map. The google maps api uses ajax and the coordinates can be entered using a seperate .js file or in the <head> section of the html page.

The coordinates are stored in my database (MySQL) and are dynamically extracted depending on what the user searches for.

However I don't want people to be able to look at the actual coordinates which they would be able to do if they were entered in the <head> section, I instead want them to be put in a seperate .js file.

My question is how do I dynamically get these coordinates from the database in a .js file?

I hope this question makes sense.

Ben Davies
__________________
Web Developer
Reply With Quote
Sponsored Links
  #2  
Old 30th August 2007, 21:30
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,743 Times in 2,577 Posts
Default

People could download the .js file and see the coordinates there, too.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 14th September 2007, 21:23
blu3ness blu3ness is offline
Junior Member
 
Join Date: Aug 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

eh, just write a php script that outputs javascript source file and then include that PHP file in your head?
Reply With Quote
  #4  
Old 14th September 2007, 21:27
Ben Ben is offline
Moderator
 
Join Date: Jul 2006
Posts: 1,029
Thanks: 7
Thanked 62 Times in 56 Posts
Default

well es both before posted, just output your data and that will result in a js code /file. but in both cases the user will be able to read the content of that js file.
IS there no other way to gather the data from google and pass the whole page, like a proxy app to the client?
Reply With Quote
  #5  
Old 29th September 2007, 06:36
blu3ness blu3ness is offline
Junior Member
 
Join Date: Aug 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

So what are you trying to do with the javascript data.

You can always initiate an AJAX request,get some XML and parse it with javascript.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2 Freezes celtic Server Operation 31 28th May 2007 17:18
Chroot SSH + ISPConfig Norman Installation/Configuration 27 26th March 2007 03:40
Systemimager (rsync) doesn't copy all comedit HOWTO-Related Questions 11 19th January 2007 17:17
ubuntu ispconfig joomla .htaccess steve1084 General 8 6th January 2007 15:55
HotSaNIC domino Tips/Tricks/Mods 23 6th November 2006 05:19


All times are GMT +2. The time now is 20:32.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.