i would like to load a smarty tpl partial inside a div with jquery, i got:
js:
function load_new_partial() {
jQuery("#ajax_zone").fadeIn('slow').load('/views/partials/partil.tpl');
}
inside tpl caller:
<a href="#" onclick="load_new_partial();">{$language_array.lang_new_campaign}</a>
<div id="ajax_zone">initial div yadadada</div>
called tpl:
{$user_name_smarty}{$account_array}
I have no problem displaying partial.tpl on clicked, problem is that loaded partial.tpl doesn't seem to get any of the variables i had already assigned to smarty.
What am i doing wrong?, how do i load a partial and make it have access to the already established smarty variables?
$smarty->assign('user_name_smarty', $user_name_smarty);
Thanks in advance.
If you load it like this, you are loading it as a text-file. What you want it to request a PHP file, that uses that TPL as a template.
Normally:
Now:
As you can see, there is no "parse tpl" stap after you load the extra tpl
You could request a PHP file with ajax, and add the result of that request to your div.