Is must be set in my Script section which is in the same page of the foreach:
@section Scripts {
<script>
/* <![CDATA[ */
jQuery(document).ready(function ($) {
'use strict';
var locations = []; // here I need to set the output
// do something with this array...
});
/* ]]> */
</script>
}
you could use Razor to create an array of object and afterward use JArray (NewtonSoft) to serialize it to json/js. I´m on holiday right now without my computer, so i can´t get you any samplecode. Hope you get your head around it.
Setup javascript array while iterating over your CurrentPages children
How can you generate a javascript array while iterating over your
Currentpage
children?My foreach:
Desired output to set in my javascript is:
Is must be set in my
Script
section which is in the same page of the foreach:Hi Michaël,
you could use Razor to create an array of object and afterward use JArray (NewtonSoft) to serialize it to json/js. I´m on holiday right now without my computer, so i can´t get you any samplecode. Hope you get your head around it.
Best regards René
is working on a reply...