First off, this is working just perfectly (doesn't mean there isn't room for improvement so tips are welcomed here as well). My concern though is in a year from now when I need to make an edit, I won't have a clue what any of this means if I leave this as-is so I'm looking for a way to better my code.
var handleActivityEdit = function(id){
var myContainer = $("#myContainer");
$.ajax({
url: "/?go=foo.bar&json",
type: "post",
dataType: "JSON",
data: 'ID=' + id,
cache: false
}).then(
function(response) {
var html = myContainerTemplate({
viewData: response.data.activityName.DATA
});
myContainer.html(html);
},
function() {
console.log("OH SNAP!");
}
);
}
The handlebar template look looks like this (simplified for clarity here) and specifically the {{1}}
is what I'd like to know if there is a way to change this variable name (e.g. in SQL, you can do select thisColumnName as ThatColumn).
<ul>
{{#each viewData}}
<li>{{1}}</li>
{{/each}}
</ul>