Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-06-13
5
Medium Priority
?
180 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 1600 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 400 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

688 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