3

i want to load some images on a click event from an external loaded javascript. At the end of the template i manage my loaded scripts via modernizr load and yep nope. On click of some of the elements i want to load a html snippet with some ee related tags for the different channel entries.

The snippet look like this:

{exp:channel:entries channel="news" status="open" dynamic="off"}
<article class="close">
    <h2>{title} TEST</h2>
</article>
{/exp:channel:entries}

As i said i use jQuery to manipulate the dom, but i'm not able to start an ajax call like this

function loadSlider(element) 
    {
        $(element).load("/system/expressionengine/templates/snippets/newswall_news.html");
    }

i get only an 403 error?

Tried it also as test to put the html snippet in the root folder, but the ee tags don't get parsed?

Any help on this would be great.

Peter

1 Answer 1

4

You're currently accessing the template from the wrong URL. EE writes URL's based off the template groups from the root of the site: index.php/template_group/template_name. If you're removing index.php from the URL, just remove it from the snippet below and this should work:

$(element).load("index.php/snippets/newswall_news");
5
  • The call to the snippet folder seems correct, but i do it over a custom javascript out of an assets folder from the root, so this javascript is requestet via modernizr at the end of the template and i get an error... Failed to load resource: the server responded with a status of 403 (Forbidden) Commented Jan 12, 2013 at 2:12
  • And it was cached, as i reloaded the site it shows me an 404 and the path is xxxlocaldomain/snippets/newswall_news.html 404 (Not Found) if leave the index.php before it reloads the whole site inside the target area... Commented Jan 12, 2013 at 2:23
  • and i tried it also with the group folder like $(element).load("/snippets.group/newswall_news"); without html and it doesn't work also. Commented Jan 12, 2013 at 2:31
  • Seems like your paths are wrong as you're getting JS errors. Can you access the script file from path you have set? Can you access the template from the root of the site? ie. domain.com/snippets/newswall_news? Commented Jan 14, 2013 at 16:08
  • I don't know why, but now it seems to work like you mentioned it. Thanks Peter Commented Mar 17, 2013 at 20:26

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.