I am trying to pass an array variable to my JavaScript method captureDetails(). However, it is throwing me error
Uncaught SyntaxError: Unexpected identifier
What am I doing wrong? I tried everything whatever is mentioned in other related posts, but no luck.
if (event.status) {
$("#targetId").empty();
$("#targetId").append("<ul>Please select if this is your organisation</ul>");
for(var i = 0; i < result.length; ++i){
var li = "<li><a href=\"#\" onclick=\"return captureDetails("+result[i]+");\">";
$("ul").append(li.concat(result[i].Name))
}
}
result?[click()](api.jquery.com/click). Plus a class name to your anchors and a data attribute holdingiand simply done.