Solved

What part of this image variable needs to be setup client side vs server side?

Posted on 2008-06-13
5
173 Views
Last Modified: 2011-10-19
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
0
Comment
Question by:Daniish
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 1

Expert Comment

by:SideFX250
ID: 21777850
readme.php.txt has an error:
$info_pic = "travel_pics/" . id . "/x_info.jpg";
should be:
$info_pic = "travel_pics/" . $id . "/x_info.jpg";
(a $ in front of $id)

0
 
LVL 82

Accepted Solution

by:
hielo earned 400 total points
ID: 21777858
currently you have:
travel_pics/"' + id + '"/x_info.jpg

the double quotes adjacent to the slashes should NOT be there. Try:
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>';
0
 
LVL 1

Assisted Solution

by:SideFX250
SideFX250 earned 100 total points
ID: 21777901
It's very easy to debug this with FireFox with the firebug extension enabled.  If you're using IE, try Fiddler.

In the "console" section of firebug, you'll be able to see your requests and responses for XMLHttp (AJAX).  They won't show up on the web page as errors.

The firebug console or fiddler would've shown the parse error noted above.


0
 
LVL 1

Expert Comment

by:SideFX250
ID: 21777924
I also recommend the "Web Developer" extension for firefox.  It allows you to easily inspect elements and even modify them inline.
0
 

Author Comment

by:Daniish
ID: 21778613
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!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question