Click here to Skip to main content
15,077,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
$('input[name="unit"]').on("change", function () {
if ($(this).is(":checked")) {
var d = $(this).attr("id");
$.getJSON("/getsubunit/" + d, function (data) {
alert("JSON Data: " + data);
$("#subunits").innerHTML(data); // Here this data is to be displayed in handlebars

What I have tried:

"subunits" is Id for lable in handlebar on which i tried to display it. i tried $("#subunits").bind(data); as well but it doesnt work. Kindlyy help
Updated 14-Aug-20 0:22am
Sandeep Mewara 14-Aug-20 2:41am
A label does not have innerHTML attribute. or bind()

what exactly you want? Get JSON and display that on screen?
Rakshanda_khan 14-Aug-20 6:55am
yes, i want to get JSON and display it on screen

1 solution

innerHTML is not a jQuery function.

Either use the html function[^]:
Or go directly to the element and set its innerHTML property:
document.getElementById("subunits").innerHTML = data;
Element.innerHTML - Web APIs | MDN[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900