0

On my app project, i secures ajax calls with a key passed to client side with the code:

<meta name="trans-en" content="<?=$_SESSION['trans-en']?>">

And after each operation (ajax call), $_SESSION ['trans-en] content is changed by the php code. How to force attribute 'content' of <meta> to take the new value without use an ajax call. Just to know if its possible to do.... sorry for my bad english, i expectes you undertands.

  • If the page content is changed, how is that accomplished? Do you use a JavaScript framework in the frontend? – Ingo Steinke Dec 07 '19 at 08:12
  • Yes, i uses jquery. What do you mean by page content is changed??? For the first load –  Dec 07 '19 at 08:14
  • I'm still not sure what exactly you want to achieve, but maybe you find a helpful solution here: https://stackoverflow.com/questions/2568760/is-it-possible-to-use-javascript-to-change-the-meta-tags-of-the-page/2568915 – Ingo Steinke Dec 07 '19 at 08:43
  • @IngoSteinke, at your link i don't find what i want. –  Dec 07 '19 at 10:00
  • attr 'content' is taking $_SESSION['...'] on page first load, but when $_SESSION['...'] is changed on execution, attr 'content' is holding old value, i want to synchronize ( 'content' and $_SESSION['...']) without javascript xhr request for security reason. –  Dec 07 '19 at 10:02
  • I just want to know if it's possible to do that through php..... –  Dec 07 '19 at 10:09
  • If you want to change a head element like meta dynamically, you need to use javascript. With php only, you would have to send a new html document (without ajax) that contains the new meta tag. – Ingo Steinke Dec 07 '19 at 10:29
  • Ok guy, but its difficult.... I will think on it. –  Dec 07 '19 at 12:28

0 Answers0