Forum Discussion

SheryBulos's avatar
5 years ago

How to pass ajax response to a macro?

Hello everyone,

I want to get json file content from the other assets and pass it to a macro to be able to display things based on this json object 

how can this be achieved?

PS. I tried this and I can see the json file content in the console however I am not able to pass it to a macro.

<@liaAddScript>
	;(function ($) {
		$.ajax({
           url : '${asset.get('/html/assets/companyProducts.json')}',
           type: 'GET',                    
           success : function(data){
           		console.log(data);
           }, 
	       error : function(data){
	        
	       }

        });
	})(LITHIUM.jQuery); 
</@liaAddScript>