Forums / Developer / called a file with ajax
Alain Mangana
Friday 24 October 2008 2:25:28 am
I want to call a livre.tpl in a template from a ajax
{literal} <script type='text/javascript'> function go(){ var xhr = getXhr(); xhr.onreadystatechange = function(){ if(xhr.readyState == 4 && xhr.status == 200){ leselect = xhr.responseText; document.getElementById('book').innerHTML = leselect; } } {/literal} var perm = "{concat($current_user.role_id_list|implode(','),'|',$current_user.limited_assignment_value_list|implode(','))|md5}"; var lien = "{"content/livre"|ezurl(no)}?&perm=" + perm; {literal} xhr.open("GET",lien ,true); xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); sel = document.getElementById('auteur'); idauteur = sel.options[sel.selectedIndex].value; xhr.send("idAuteur="+idauteur); } </script> {/literal}
in return I want to have nothing but the contents of the file without the structure of the page pagelayout.who can help me
http://tikdem.com /
Yannick Komotir
Friday 24 October 2008 2:58:40 am
see this post http://ez.no/developer/forum/developer/problem_with_ajax_and_ez_publish
<|- Software Engineer @ eZ Publish developpers -|> @ http://twitter.com/yannixk
John Moritz
Friday 24 October 2008 10:46:59 am
Do you realy want to call the .tpl file directly, or do you want to get the output from the php file of your template/module?
You can replace the Template output like $tpl->fetch("design:module/your-template.tpl"); with: eZExecution::cleanExit(); Just replace it....doneThis means that you get the clean output of the php script of your module.
Script start
Module start 'content'
Module end 'content'
Script end
Time used to render debug report: 0.0001 secs