Pass variables from a nested asset to Rest Resource JS


(autjoe) #1

Hi there,

I am trying to use a nested asset in an asset listing type format, which needs to pass the listing asset url to another Reset Resource Js, and get the response back.

In nested content. I am trying to pass the listing asset's url to the nested Rest JS by setting the variable name as metaA, variable value to %asset_url%, then in the rest resource JS, using %globals_get_metaA%, which seems not getting the value from the listing assets. I can pass the the value such as "About", but not a url or with key words %asset_url%.

I tried using %nested_asset_url%, still no luck.

Anyone can help, would be really appreciated.

Thanks.

 


(Bart Banda) #2

Try using either %list_current_asset_id^as_asset:asset_url%, or %nested_get_metaA% and see if that works.


(autjoe) #3

Thanks, but No luck, I can set a value such as "About" in Send the following additional GET variables to the asset:, which can passed it to Rest JS. , but not a url or with key words %asset_url% or %asset_url^urlencode%


(Bart Banda) #4

This sounds a bit familiar, but not sure if it is a bug or just not supposed to work like that. Seems like the nested asset block is not being able to recognise the %asset_url% keyword. 

ANother option would be to instead of using a nested body copy div, use %globals_asset_contents_paint_XXXX% where XXX is the id of the paint layout you want to use, then nest in the rest JS resource in there and using %asset_url% on the rest JS asset directly and not passing it via the GET variables. 


(autjoe) #5

Thanks Bart, but how do I nest the rest js in paint layout?


(autjoe) #6

I will still need to pass the asset url to the rest js and display the response on the listing page.


(Bart Banda) #7

You just nest it in the same way you do with your type format, but instead, you create a nested div block on the paint layout and nest it in there. I'm not saying that this will work, and if you are not comfortable using paint layouts or if you've had very little experience with them, then maybe it's not the best solution for you as it can get trickier for you. 


(autjoe) #8

same issue, it just doesn't allow to pass the url via the nested content.


(Aleks Bochniak) #9

I would suggest you use a paint layout  %asset_contents_paint_xxxxx% as your asset listing type format. And nest the rest resource into the type format of the paint layout.

 

You should then be able to use %asset_url% successfully


(autjoe) #10

Thanks..