|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Kebsox Smarty n00b
Joined: 19 Dec 2019 Posts: 1
|
Posted: Thu Dec 19, 2019 10:54 am Post subject: Trouble with an Ajax request |
|
|
Hello! I have some troubles with a ajax request
I try to modify a smarty variable in a php file call by a java-script function in a tpl file.
So i got 3 files one to call the tpl in php :
Code: | <?php
// Include
require('./base.inc');
require(BASE . '/../config.inc');
$smarty = new MySmarty();
require(BASE . '/../includes/header.inc');
$_SESSION['message'] = 'Invalid URL';
$smarty->assign('xajax', $xajax->getJavascript("", "assets/js/xajax.js"));
$smarty->display('www_mobileQRCode.tpl');
?> |
My .tpl
Code: |
Smarty *}
{include file="www_header.tpl"}
<script type="text/javascript">
{literal}{{/literal}xajax_lireNom("test"){literal}}{/literal};
</script>
{if isset($materiel)}
<div class="text-center">
{$materiel}
</div>
{/if}
</body>
{include file="www_footer.tpl"}
|
and a file with my xajax :
Code: |
function lireNom($Materiel_Id){
global $lang;
$objResponse = new xajaxResponse('ISO-8859-1');
$smarty = new MySmarty();
$smarty->assign('materiel', 'xajax');
return $objResponse->getXML();
}
|
But I get nothing in my smarty('materiel')
Do you have an idea to solve this problem?
Thx for your time! |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|