Daniish
asked on
What part of this image variable needs to be setup client side vs server side?
Hello,
I'm trying to display an image in my Google Maps Infowindow. To this end i need a little further help setting up this variable:
var info = '<div id="info" style="text-align:left";>< img src="travel_pics/"' + id + '"/x_info.jpg" width=150 height=100><h3>' + title + '</h3><br>' + date + '</div>';
In particular i'm having difficulty with this part:
<img src="travel_pics/"' + id + '"/x_info.jpg"
I understand there's an issue because Javascript doesn't know what images are on the server, so this needs to be defined server-side in my php.
Please can you tell me what specifically i need to define in my php script and what needs to go in my javascript to make this work?
(i have attached both my javascript 'index.php' and my php script 'read.php' for your reference).
Many thanks
index.php.txt
read.php.txt
I'm trying to display an image in my Google Maps Infowindow. To this end i need a little further help setting up this variable:
var info = '<div id="info" style="text-align:left";><
In particular i'm having difficulty with this part:
<img src="travel_pics/"' + id + '"/x_info.jpg"
I understand there's an issue because Javascript doesn't know what images are on the server, so this needs to be defined server-side in my php.
Please can you tell me what specifically i need to define in my php script and what needs to go in my javascript to make this work?
(i have attached both my javascript 'index.php' and my php script 'read.php' for your reference).
Many thanks
index.php.txt
read.php.txt
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
I also recommend the "Web Developer" extension for firefox. It allows you to easily inspect elements and even modify them inline.
ASKER
Thanks to both of you, although SideFX250 your 1st post is incorrect. If i use the dollar sign then Firebug reports that $id is undefined!
$info_pic = "travel_pics/" . id . "/x_info.jpg";
should be:
$info_pic = "travel_pics/" . $id . "/x_info.jpg";
(a $ in front of $id)