Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Trouble with an Ajax request

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Kebsox
Smarty n00b


Joined: 19 Dec 2019
Posts: 1

PostPosted: Thu Dec 19, 2019 10:54 am    Post subject: Trouble with an Ajax request Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP