I have a phtml (system.phtml) with <script> in it and a variable like console.log(data).

<?php $checkcustomer = $block->Customerlogin(); ?>

 <script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
 <script type="text/javascript" charset="utf-8">

  var data= 12345; 

Now i am getting the variable value in console and i also want its value in my block to do further processing on it how can i get data variable value in block or controller?

  • So you want a value from your JS into your HTML? – Ben Crook May 15 '19 at 9:50
  • i want value from JS to my PHP block file – Asad Ullah May 15 '19 at 9:57
  • 1
    Your question is not clear to me. Please update your question with the code lines. – Khoa TruongDinh May 15 '19 at 10:18
  • Is it ajax call from controller to block? – aravind May 15 '19 at 10:23
  • nope just js i don't know any approach to send variable value either with ajax or jquery – Asad Ullah May 15 '19 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.