Skip to Content
Menu
This question has been flagged
1 Reply
3120 Views

How to receive data from java-script file to template 

  when i am clicking button in template first it enters into js file and i need response from js file to same template. can you text the procedure how to do. 

Avatar
Discard
Best Answer

Hello

there are many ways you can do it. I'll show you one method to write value of a variable in js to xml template

you can define global variables in your init function.

init: function(parent,options){
this._super(parent,options);
this.var_name = 0

create a div in xml template

<div class="some_class"/>

Edit it on button click, and write your value to div from js

$(".some_class").text(this.var_name);


Avatar
Discard