Adding HTML elements into a table column dynamically using Jquery AJAX (RadioButton)

Published: 05 August 2023
on channel: Fired Developer
390
7

Here I have shown you how you can add HTML elements inside a table that is generated from Jquery AJAX call. or Dynamically.

PS: < IS FOR LESSTHAN SIGN AND > IS FOR GREATER THAN SIGN AS YOUTUBE DOES NOT ALLOW ANGLE BRACKETS
Please replace @lt; with greater than sign and > with greater than sign
==========================
< script type="text/javascript" >
$(document).ready(function () {
debugger;
//var pname = $('#dpdnperson :selected').text();
//var pid = $('#txtSlno').val();

$('#btnGetAll').click(function () {
debugger;
getData();
})


function getData()
{
debugger;
$.ajax({
type: 'GET',
url: 'http://localhost:5251/api/Student',
contentType: 'json',
//data: { txtFromDate: dfrom, txtToDate: dto, dpdnperson: pname, id: pid },
success: function (response) {
if (response.length == 0) {
alert(response);
} else {
//alert(response);
$.each(response, function (index, item)
{
$("#studtblbody").append(" < tr> < td> < input type='radio' id='rd1' name='rd1' value=" + item.Id + " group='rad1' /> < input type='hidden' id='r1' name='r1' value=" + item.Id + " /> </td> <td > " + item.StudentName + " </td> <td> " + item.age + " </td> <td> " + item.Address + " </td> <td> Edit | Delete </td> </tr> ");
});
}
},
error: function (err) {
alert(error);
console.error(err);
}
});
}

$(document).on("click", "#ibtn", function () {
debugger;
//$(this).text("It works!");
//$(this).prop("value", "Input New Text");
$(this).val("Input New Text");
alert("Something");
});

$(document).on("click", "a", function () {
debugger;
$(this).text("It works!");
alert("link clicked");
});

$(document).on("click", "#rd1", function () {
debugger;
//$(this).text("It works!");
alert("radio clicked");
});
***************************************************

#jquery #htmlelements #elementsintable


On this page of the site you can watch the video online Adding HTML elements into a table column dynamically using Jquery AJAX (RadioButton) with a duration of hours minute second in good quality, which was uploaded by the user Fired Developer 05 August 2023, share the link with friends and acquaintances, this video has already been watched 390 times on youtube and it was liked by 7 viewers. Enjoy your viewing!