It is possible to parse an ExpressionEngine snippet inside a page via Ajax ?


{exp:channel:entries channel="news" limit="10"}

The EE code would be processed and returned as html or not??


I don't think so unless you write a plugin to access the code in the DB. However you could easily create a hidden template IE ( _parsed_data.html). Then AJAX load it in to your to your current template using Jquery AJAX .load().


You can also with javascript depending on how you generate that url pass parameter restrictions through the url using segments.

Data Template:

{exp:channel:entries channel="news" limit="{segment_3}"}

Viewed Template:

var seg3 = 3;

$("div#parsedData").load("{site_url}/templategroup/_parsed_data.html/ '+ seg3");
  • mattsidjohn, thanks a lot for you very interesting and clear solution!! – Stéphane Mar 29 '14 at 17:11
  • You are welcome feel free to reach out any time @mattsidjohn – mattsidjohn Mar 29 '14 at 17:28
  • There is no hidden template. The moment you expose such an ajax url, anybody can inject whatever they want. you NEVER want to give generic (outside) world access to inject arbitrary ee tags. Anybody can then inject whatever tag code and completely pull any data from your system!!! (exclamation mark) – GDmac Mar 29 '14 at 17:54
  • Problems of security injection. Does exist a more safe method?? – Stéphane Mar 29 '14 at 18:33
  • 1
    I disagree GDmac.... you aren't giving the world access to post data.... in this case. However if its private data wrap the EE code in {if logged_in}{/if} – mattsidjohn Mar 29 '14 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.