Create Table Dynamically using Jquery

In this tutorial we will create table dynamically using jquery 1.10. In the below example we are using jQuery.getJSON( url, [data] [success] ) function of jquery to load json encoded data from server using get http request.
ParameterDescription
urlurl is equired and a string containing the url to which the request is sent.
datadata is plainObject or string type and is optional. data is sent to the server with the request
successsuccess is a callback function with additional parameters, that is executed if the request succeeds. It is optional and is of Function( PlainObject data, String textStatus, jqXHR jqXHR ) type.
data contains the data that is returned from the server.
textStatus contains the request status ("success", "notmodified", "error", "timeout", or "parsererror")
jqXHR contains the XMLHttpRequest object.

Example to Create Table Dynamically using Jquery:-

Json file used in above example:-

In the exaple we are fetching data from server using the getJson function, which returns json type data in response. after getting response we are just iterating and appending it’s value to table tbody.

output:-
Create Table Dynamically using Jquery

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.