Gmap3 - Forum

Gmap3 exchange platform

You are not logged in.

Ads
(server costs 27.50€ per month)

#1 2012-06-09 23:13:20

BeerBuddha
Member
Registered: 2012-06-09
Posts: 1

HREF in Infowindow within Marker

Here is the sceneario

1) im using a json system to add data to markers similar to http://jsfiddle.net/3d2cQ/
2) all the markers load inside the infowindow with this type of click event: http://jsfiddle.net/BA8k4/

my problem:
how do i add a HREF link to the info window so that lets say the click on a link within the infowindow the user goes to another page.

I tried modifying the JSON to include HREF tag but that didnt work - or should it work?

im using PHP to build my ajax json tag which retrieve from my ajax call.

Any examples or solution suggested for this problem?
tks

Offline

Ads
(server costs 27.50€ per month)

#2 2012-06-11 06:35:49

charlietfl
Moderator
Registered: 2011-11-24
Posts: 201

Re: HREF in Infowindow within Marker

You can put html in infoWindow, including anchors.
Provide example of what you tried. Demo's you provided are only using text.

Offline

#3 2012-06-11 14:09:02

mahieux06
Member
Registered: 2012-05-07
Posts: 25

Re: HREF in Infowindow within Marker

moving From

data:'test1 !'

to

 
data:'test1 <br><a href="thisurl"> get this to work</a>'

should do
no ?

Last edited by mahieux06 (2012-06-11 14:09:55)

Offline

#4 2012-06-13 04:22:26

degt
Member
Registered: 2012-05-15
Posts: 33
Website

Re: HREF in Infowindow within Marker

I tried that myself and could see the markup rather than the HTML rendering.

Offline

#5 2012-06-20 11:26:35

mahieux06
Member
Registered: 2012-05-07
Posts: 25

Re: HREF in Infowindow within Marker

yep example would help much

Offline

#6 2012-06-28 07:56:32

Schlischa
Member
Registered: 2012-06-27
Posts: 3

Re: HREF in Infowindow within Marker

I´ve got the same problem. But just when I try to use two links. My projekt is a gmap3 with some markers. Each marker has an infowindow. The text for this infowindow is type in my jason under ”description”. So there is no problem with text in there or a link. But just when I try to type in two or more links, my map don´t show any marker or infowindow in the browser. Just my old Firefox 3.6.24) forgive my mistake. But for example under Safari (5.0.5) or a newer Firefox, only the clean map is loading.
So here is the json:

{
    "places": [
            
        {
            "title": "Cafe Raab",
            "description": "Café Raab",
            "lat": 50.0040,
            "lng": 8.2015,
            "image": "marker_cafe.png"
        },
        
        {
            "title": "Am Sportfeld",
            "description": "<a href=\"http://way/to/link/site.html\" target=\"_blank\">MVGmeinRad Station</a>",
            "lat": 50.00477,
            "lng": 8.20110,
            "image": "marker_radstation.png"
        },
        
        {
            "title": "Kapellenstraße / Gesundheitszentrum",
            "description": "<a href=\"http://way/to/link/site.html\" target=\"_blank\">Buslinie 47</a> (Wiesbaden <-> Mz-Gonsenheim) <br></br>
            <a href=\"http://way/to/link/site.html\" target=\"_blank\">Buslinie 64</a>(Mz-Laubenheim <-> Budenheim) <br></br> 
            <a href=\"http://way/to/link/site.html\" target=\"_blank\">Straßenbahnlinie 50</a> (Mz-Hechtsheim <-> Mz-Finthen)<br></br> 
            <a href=\"http://way/to/link/site.html\" target=\"_blank\">Straßenbahnlinie 51</a>(Mz-Hechtsheim <-> Mz-Finthen)<br></br> 
            <a href=\"http://way/to/link/site.html\" target=\"_blank\">MVGmeinRad Station</a>",
            "lat": 50.00158,
            "lng": 8.20461,
            "image": "marker_64_50_51_rad.png" 
        }
    ]
}

Any ideas? Thanks for comments.
°° I hope you understand what I write. Cause I am german wink °°

Schlischa

Offline

#7 2012-06-28 10:18:52

Schlischa
Member
Registered: 2012-06-27
Posts: 3

Re: HREF in Infowindow within Marker

A update of my current jason data:

{
   "places":[
      {
         "title":"Cafe Raab",
         "description":"Café Raab",
         "lat":50.0040,
         "lng":8.2015,
         "image":"marker_cafe.png"
      },
      {
         "title":"Am Sportfeld",
         "description":"<a href=\"http://way/to/link/site.html\" target=\"_blank\">MVGmeinRad Station</a>",
         "lat":50.00477,
         "lng":8.20110,
         "image":"marker_radstation.png"
      },
      {
         "title":"Kapellenstraße/Gesundheitszentrum",
         "description":
         [
            "<a href=\"http://way/to/link/site.html\" target=\"_blank\">Buslinie 47</a> (Wiesbaden <-> Mz-Gonsenheim) <br></br>",
            "<a href=\"http://way/to/link/site.html\" target=\"_blank\">Buslinie 47</a> (Wiesbaden <-> Mz-Gonsenheim) <br></br>",
            "<a href=\"http://way/to/link/site.html\" target=\"_blank\">Buslinie 47</a> (Wiesbaden <-> Mz-Gonsenheim) <br></br>"
         ],
         "lat":50.00158,
         "lng":8.20461,
         "image":"marker_64_50_51_rad.png"
      }
   ]
}

So the marker and the infobox is show! Jeah big_smile ! But now, the comma after the <br></br>" is also displaying sad . So my second and third link is named ",Buslinie 47 (...)" instead of "Buslinie 47 (...)" (note the comma wink )

what do you think? If I delet the comma, my code is false and it´s shown nothing again.

Offline

#8 2012-06-28 12:45:27

mahieux06
Member
Registered: 2012-05-07
Posts: 25

Re: HREF in Infowindow within Marker

did you try replacing the outer " (dblquot) by ' (simplequot) ? and , by + if I understand you wanna display
link1

link2

link3

'<a href=\"http://way/to/link/site.html\" target=\"_blank\">Buslinie 47</a> (Wiesbaden <-> Mz-Gonsenheim) <br></br>'+
'<a href=\"http://way/to/link/site.html\" target=\"_blank\">Buslinie 47</a> (Wiesbaden <-> Mz-Gonsenheim) <br></br>'+
'<a href=\"http://way/to/link/site.html\" target=\"_blank\">Buslinie 47</a> (Wiesbaden <-> Mz-Gonsenheim) <br></br>'

Last edited by mahieux06 (2012-06-28 12:50:42)

Offline

#9 2012-07-02 08:06:26

Schlischa
Member
Registered: 2012-06-27
Posts: 3

Re: HREF in Infowindow within Marker

Sorry, don´t work sad but thx for help wink

I wanna display:
link1 text

link2 text

link3 text

But I've got a good message. Know it works! The Code just have to be in one line!!! So here is the Code:

{
   "places":[
      {
         "title":"Cafe Raab",
         "description":"Café Raab",
         "lat":50.0040,
         "lng":8.2015,
         "image":"marker_cafe.png"
      },
      {
         "title":"Am Sportfeld",
         "description":"<a href=\"http://way/to/link/site.html\" target=\"_blank\">MVGmeinRad Station</a>",
         "lat":50.00477,
         "lng":8.20110,
         "image":"marker_radstation.png"
      },
      {
         "title":"Kapellenstraße/Gesundheitszentrum",
         "description":
         [
            "<a href=\"http://way/to/link/site.html\" target=\"_blank\">Buslinie 47</a> (Wiesbaden <-> Mz-Gonsenheim) <br /><br /><a href=\"http://way/to/link/site.html\" target=\"_blank\">Buslinie 47</a> (Wiesbaden <-> Mz-Gonsenheim)<br /><br /><a href=\"http://way/to/link/site.html\" target=\"_blank\">Buslinie 47</a> (Wiesbaden <-> Mz-Gonsenheim)"
         ],
         "lat":50.00158,
         "lng":8.20461,
         "image":"marker_64_50_51_rad.png"
      }
   ]
}

Offline

#10 2012-07-02 14:45:56

charlietfl
Moderator
Registered: 2011-11-24
Posts: 201

Re: HREF in Infowindow within Marker

"description" shouldn't be an array

Offline

Board footer

Powered by FluxBB