ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to pass the {exp:channel:entries} data into jquery ?

September 17, 2011 11:10am

Subscribe [4]
  • #1 / Sep 17, 2011 11:10am

    Rahul gamit

    24 posts

    Hi
    i am implementing Google map in my site and i want to pass longitude and longitude variable in jquery using expression engine .
    so do you know how can i do this ?
    this is my code

    $(function() {
        
    $("#map").gMap(
    { controls:["GSmallMapControl", "GMapTypeControl"],
    scrollwheel:true,
    {exp:channel:entries entry_id="129"}
    {latitude},
    {longitude},
    {/exp:channel:entries}
                      zoom: 6 });
    });

    if i am writing {exp:channel:entries} tag than the jquery is not working .

  • #2 / Sep 27, 2011 9:59am

    ralph.m

    225 posts

    What would the jQuery code look like if just hard coded?

  • #3 / Sep 30, 2011 2:46pm

    jcowen

    66 posts

    I’ve done something similar to this and what you’re doing looks like it should work.

    Is your jquery within an EE template? If you’re trying to do this from a .js file I don’t think it will work.

  • #4 / Dec 06, 2011 7:52am

    Jack McDade

    425 posts

    You have a few options.

    First, you could use an ExpressionEngine managed .js file. Just create a js type template (or suffix with .js if you’re creating via flat file) and reference it with the {path} tag when writing your script include. This would let you use EE tags inside your js file.


    Option two is to write your js in your EE template (preferably inside the head, or before the body closing). Just write your [removed] [removed] tags and use EE tags inside your js.

    Option three would be to create js varables in your EE code, and use them in your “static” js file.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases