How can I create JSON into kendo template??
Here is my code:
<script type="text/x-kendo-template">
...
# for(i = 0; i < data.length; i++) { #
# var myJson= { #
# "ID" : data[i].ID, #
# "Name" : data[i].name, #
# "Description" : data[i].desc, #
# "C_ID" : $("#customers").data("kendoDropDownList").value(), #
# "isNew" : true#
# } #
...
</script>
The problem is the hash sign in the jquery selector:
$("#customers")
The template parser uses the # sign to mark the start/end of script code. To use a hash within a section of script it needs to be escaped with a double backslash like so:
$("\\#customers")