ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.2 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://www.aspsnippets.com/Articles/3658/Populate-Table-from-API-using-jQuery/ |
| Last Crawled | 2026-04-04 18:46:01 (5 days ago) |
| First Indexed | 2023-11-23 01:24:30 (2 years ago) |
| HTTP Status Code | 200 |
| Meta Title | Populate Table from API using jQuery |
| Meta Description | explained with an example, how to populate HTML Table from external API using jQuery. |
| Meta Canonical | null |
| Boilerpipe Text | In this article I will explain with an example, how to populate HTML Table from external API using
jQuery
.
ASPSnippets Test API
The following API will be used in this article.
The API returns the following JSON.
[
{
"CustomerId":1,
"Name":"John Hammond",
"Country":"United States"
},
{
"CustomerId":2,
"Name":"Mudassar Khan",
"Country":"India"
},
{
"CustomerId":3,
"Name":"Suzanne Mathews",
"Country":"France"
},
{
"CustomerId":4,
"Name":"Robert Schidner",
"Country":"Russia"
}
]
HTML Markup
The following HTML Markup consists of an HTML DIV element.
<
h4
>
Customers
</
h4
>
<
hr
/>
<
div
id
="dvCustomersGrid"></
div
>
Populating HTML Table from API using jQuery
Inside the
jQuery
document ready
event handler, the API URL is called using the
jQuery
get
function.
Inside the
jQuery
get
success
event, the received response is converted to JavaScript Array using the
JSON.parse
JavaScript function and set in the
customers
variable.
Adding the Header Row
The Header Row will be built using Table TH element and appended using
jQuery
.
Adding the Data Rows
A loop is executed over the Array elements and one by one a Row is created in the HTML Table.
Table insertRow Method
: This method adds a new row to a Table at the specified index. If the index is supplied as -1 then the row will be added at the last position.
Then inside each Row, a dynamic Cell element is created and appended using
jQuery
.
Adding the dynamic Table to the Page
Finally, the dynamically created table is added to the page by appending it to the HTML DIV using the
append
method.
Note
: You can also append an element to the body but then you won’t be able to set its placement on the page. Using a container such a DIV helps us add the dynamic element to the desired place.
<
script
type
="text/javascript"
src
="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></
script
>
<
script
type
="text/javascript">
$(
function
() {
$.get(
"https://raw.githubusercontent.com/aspsnippets/test/master/Customers.json"
,
function
(data, status) {
var
customers = JSON.parse(data);
//Create a HTML Table element.
var
table = $(
"<table />"
);
table[0].border =
"1"
;
//Add the header row.
var
row = $(table[0].insertRow(-1));
//Add the header cells.
var
headerCell = $(
"<th />"
);
headerCell.html(
"CustomerId"
);
row.append(headerCell);
var
headerCell = $(
"<th />"
);
headerCell.html(
"Name"
);
row.append(headerCell);
var
headerCell = $(
"<th />"
);
headerCell.html(
"Country"
);
row.append(headerCell);
//Add the data rows.
for
(
var
i = 0; i < customers.length; i++) {
//Add the data row.
var
row = $(table[0].insertRow(-1));
//Add the data cells.
var
cell = $(
"<td />"
);
cell.html(customers[i].CustomerId);
row.append(cell);
cell = $(
"<td />"
);
cell.html(customers[i].Name);
row.append(cell);
cell = $(
"<td />"
);
cell.html(customers[i].Country);
row.append(cell);
}
var
dvTable = $(
"#dvCustomersGrid"
);
dvTable.html(
""
);
dvTable.append(table);
});
});
</
script
>
Screenshot
Browser Compatibility
The above code has been tested in the following browsers.
* All browser logos displayed above are property of their respective owners.
Demo
Downloads |
| Markdown | [](https://www.aspsnippets.com/)
حضرت خواجہ سیدنا معین الدین حسن چشتی سنجاری اجمیری رحمۃ اللہ علیہ
[](https://www.aspsnippets.com/)
- [HOME](https://www.aspsnippets.com/)
- [BLOGS](https://www.aspsnippets.com/articles/all)
- [ASP.Net](https://www.aspsnippets.com/Categories/ASP.Net/)
[C\#.Net](https://www.aspsnippets.com/Categories/C.Net/)
[JavaScript](https://www.aspsnippets.com/Categories/JavaScript/)
[ADO.Net](https://www.aspsnippets.com/Categories/ADO.Net/)
[Excel](https://www.aspsnippets.com/Categories/Excel/)
[AJAX](https://www.aspsnippets.com/Categories/AJAX/)
[VB.Net](https://www.aspsnippets.com/Categories/VB.Net/)
[SQL Server](https://www.aspsnippets.com/Categories/SQL-Server/)
[GridView](https://www.aspsnippets.com/Categories/GridView/)
[Issues and Exceptions](https://www.aspsnippets.com/Categories/Issues-and-Exceptions/)
[Silverlight](https://www.aspsnippets.com/Categories/Silverlight/)
[Rich Text Editor](https://www.aspsnippets.com/Categories/Rich-Text-Editor/)
[jQuery](https://www.aspsnippets.com/Categories/jQuery/)
[DataList](https://www.aspsnippets.com/Categories/DataList/)
[Snippets](https://www.aspsnippets.com/Categories/Snippets/)
[XML](https://www.aspsnippets.com/Categories/XML/)
[New Features](https://www.aspsnippets.com/Categories/New-Features/)
[.Net 4.0](https://www.aspsnippets.com/Categories/.Net-4.0/)
[TreeView](https://www.aspsnippets.com/Categories/TreeView/)
[AJAX Control Toolkit](https://www.aspsnippets.com/Categories/AJAX-Control-Toolkit/)
[jQuery Plugins](https://www.aspsnippets.com/Categories/jQuery-Plugins/)
[Third Party Controls](https://www.aspsnippets.com/Categories/Third-Party-Controls/)
[ASP.Net Validators](https://www.aspsnippets.com/Categories/ASP.Net-Validators/)
[WCF](https://www.aspsnippets.com/Categories/WCF/)
[Repeater](https://www.aspsnippets.com/Categories/Repeater/)
[Regular Expressions](https://www.aspsnippets.com/Categories/Regular-Expressions/)
[Yahoo API](https://www.aspsnippets.com/Categories/Yahoo-API/)
[iTextSharp](https://www.aspsnippets.com/Categories/iTextSharp/)
[FaceBook](https://www.aspsnippets.com/Categories/FaceBook/)
[Charts](https://www.aspsnippets.com/Categories/Charts/)
[ListView](https://www.aspsnippets.com/Categories/ListView/)
[Tweeter](https://www.aspsnippets.com/Categories/Tweeter/)
[Google](https://www.aspsnippets.com/Categories/Google/)
[CSS](https://www.aspsnippets.com/Categories/CSS/)
[SMS](https://www.aspsnippets.com/Categories/SMS/)
[DotNetZip](https://www.aspsnippets.com/Categories/DotNetZip/)
[Crystal Reports](https://www.aspsnippets.com/Categories/Crystal-Reports/)
[Entity Framework](https://www.aspsnippets.com/Categories/Entity-Framework/)
[HyperLink](https://www.aspsnippets.com/Categories/HyperLink/)
[RDLC Report](https://www.aspsnippets.com/Categories/RDLC-Report/)
[SqlDataSource](https://www.aspsnippets.com/Categories/SqlDataSource/)
[Menu](https://www.aspsnippets.com/Categories/Menu/)
[YouTube](https://www.aspsnippets.com/Categories/YouTube/)
[Twitter](https://www.aspsnippets.com/Categories/Twitter/)
[HTML](https://www.aspsnippets.com/Categories/HTML/)
[XmlDataSource](https://www.aspsnippets.com/Categories/XmlDataSource/)
[ListBox](https://www.aspsnippets.com/Categories/ListBox/)
[Tips](https://www.aspsnippets.com/Categories/Tips/)
[DataGridView](https://www.aspsnippets.com/Categories/DataGridView/)
[Cryptography](https://www.aspsnippets.com/Categories/Cryptography/)
[Windows Forms](https://www.aspsnippets.com/Categories/Windows-Forms/)
[LinkedIn](https://www.aspsnippets.com/Categories/LinkedIn/)
[WebUserControl](https://www.aspsnippets.com/Categories/WebUserControl/)
[RSS Feeds](https://www.aspsnippets.com/Categories/RSS-Feeds/)
[HTML5](https://www.aspsnippets.com/Categories/HTML5/)
[Sitemap](https://www.aspsnippets.com/Categories/Sitemap/)
[IIS](https://www.aspsnippets.com/Categories/IIS/)
[LINQ](https://www.aspsnippets.com/Categories/LINQ/)
[DataPager](https://www.aspsnippets.com/Categories/DataPager/)
[URL Routing](https://www.aspsnippets.com/Categories/URL-Routing/)
[SqlBulkCopy](https://www.aspsnippets.com/Categories/SqlBulkCopy/)
[OCR](https://www.aspsnippets.com/Categories/OCR/)
[ASP.Net 4.5](https://www.aspsnippets.com/Categories/ASPNet-45/)
[Master Pages](https://www.aspsnippets.com/Categories/Master-Pages/)
[MySQL](https://www.aspsnippets.com/Categories/MySQL/)
[CSV](https://www.aspsnippets.com/Categories/CSV/)
[Stored Procedures](https://www.aspsnippets.com/Categories/Stored-Procedures/)
[JSON](https://www.aspsnippets.com/Categories/JSON/)
[Web Services](https://www.aspsnippets.com/Categories/Web-Services/)
[Bootstrap](https://www.aspsnippets.com/Categories/Bootstrap/)
[Windows Service](https://www.aspsnippets.com/Categories/Windows-Service/)
[DataTable](https://www.aspsnippets.com/Categories/DataTable/)
[App.Config](https://www.aspsnippets.com/Categories/AppConfig/)
[Visual Studio](https://www.aspsnippets.com/Categories/Visual-Studio/)
[RadioButton](https://www.aspsnippets.com/Categories/RadioButton/)
[CheckBox](https://www.aspsnippets.com/Categories/CheckBox/)
[Generic Handler](https://www.aspsnippets.com/Categories/Generic-Handler/)
[DropDownList](https://www.aspsnippets.com/Categories/DropDownList/)
[FileUpload](https://www.aspsnippets.com/Categories/FileUpload/)
[RadioButtonList](https://www.aspsnippets.com/Categories/RadioButtonList/)
[CheckBoxList](https://www.aspsnippets.com/Categories/CheckBoxList/)
[Flash](https://www.aspsnippets.com/Categories/Flash/)
[HtmlEditorExtender](https://www.aspsnippets.com/Categories/HtmlEditorExtender/)
[Div](https://www.aspsnippets.com/Categories/Div/)
[Table](https://www.aspsnippets.com/Categories/Table/)
[AngularJS](https://www.aspsnippets.com/Categories/AngularJS/)
[DataReader](https://www.aspsnippets.com/Categories/DataReader/)
[DataSet](https://www.aspsnippets.com/Categories/DataSet/)
[Console Applications](https://www.aspsnippets.com/Categories/Console-Applications/)
[FTP](https://www.aspsnippets.com/Categories/FTP/)
[DetailsView](https://www.aspsnippets.com/Categories/DetailsView/)
[Password TextBox](https://www.aspsnippets.com/Categories/Password-TextBox/)
[Enum](https://www.aspsnippets.com/Categories/Enum/)
[ComboBox](https://www.aspsnippets.com/Categories/ComboBox/)
[Sponsored](https://www.aspsnippets.com/Categories/Sponsored/)
[SqlDataAdapter](https://www.aspsnippets.com/Categories/SqlDataAdapter/)
[OpenXml](https://www.aspsnippets.com/Categories/OpenXml/)
[ClosedXml](https://www.aspsnippets.com/Categories/ClosedXml/)
[SiteMapPath](https://www.aspsnippets.com/Categories/SiteMapPath/)
[Arrays](https://www.aspsnippets.com/Categories/Arrays/)
[FormView](https://www.aspsnippets.com/Categories/FormView/)
- [FORUMS](https://www.aspsnippets.com/Articles/3658/Populate-Table-from-API-using-jQuery/)
- [Questions](https://www.aspsnippets.com/questions/all)
- [Ask Question](https://www.aspsnippets.com/questions/ask)
- [VIDEOS](https://www.aspsnippets.com/videos/all)
- []()
- [SEARCH]()
- [INTERVIEW](https://www.aspsnippets.com/Articles/3658/Populate-Table-from-API-using-jQuery/)
- [Interview Questions](https://www.aspsnippets.com/interviewquestions/all)
- [COMMUNITY](https://www.aspsnippets.com/Articles/3658/Populate-Table-from-API-using-jQuery/)
- [Users](https://www.aspsnippets.com/users/all/)
- [CONTACT](https://www.aspsnippets.com/contact/)
- 
Search
Ask Question
[](https://www.aspsnippets.com/)
### Company
- [About us](https://www.aspsnippets.com/Articles/3658/Populate-Table-from-API-using-jQuery/)
- [Contact us](https://www.aspsnippets.com/contact/)
### Explore
- [Ask question](https://www.aspsnippets.com/questions/ask)
- [FAQs]()
- [Privacy policy](https://www.aspsnippets.com/PrivacyPolicy)
### Follow us
- [Facebook](https://www.facebook.com/ASPSnippets/)
- [Instagram](https://www.instagram.com/ASPSnippets/)
- [YouTube](https://youtube.com/ASPSnippetsChannel)
- [Twitter](https://www.twitter.com/ASPSnippets)
### Contact Us
- Email: [webmaster@aspsnippets.com](mailto:webmaster@aspsnippets.com)
- Address:
ASPSNIPPETS PRIVATE LIMITED
G-110, SHAGUN ARCADE,
MALAD (EAST),
MUMBAI, MAHARASHTRA,
INDIA 400097.
© COPYRIGHT 2026 [ASPSnippets.com](https://www.aspsnippets.com/) ALL RIGHTS RESERVED.
Disclaimer
This site makes use of Cookies. Please refer [Privacy Policy](https://www.aspsnippets.com/PrivacyPolicy) for more details.
***
[Allow]() [Reject]() |
| Readable Markdown | In this article I will explain with an example, how to populate HTML Table from external API using [jQuery](https://www.aspsnippets.com/Categories/jQuery.aspx).
**ASPSnippets Test API**
The following API will be used in this article.
The API returns the following JSON.
\[
{
"CustomerId":1,
"Name":"John Hammond",
"Country":"United States"
},
{
"CustomerId":2,
"Name":"Mudassar Khan",
"Country":"India"
},
{
"CustomerId":3,
"Name":"Suzanne Mathews",
"Country":"France"
},
{
"CustomerId":4,
"Name":"Robert Schidner",
"Country":"Russia"
}
\]
**HTML Markup**
The following HTML Markup consists of an HTML DIV element.
\<h4\>Customers\</h4\>
\<hr/\>
\<div id\="dvCustomersGrid"\>\</div\>
**Populating HTML Table from API using jQuery**
Inside the [jQuery](https://www.aspsnippets.com/Categories/jQuery.aspx) document ready event handler, the API URL is called using the [jQuery](https://www.aspsnippets.com/Categories/jQuery.aspx) get function.
Inside the [jQuery](https://www.aspsnippets.com/Categories/jQuery.aspx) get success event, the received response is converted to JavaScript Array using the JSON.parse JavaScript function and set in the customers variable.
Adding the Header Row
The Header Row will be built using Table TH element and appended using [jQuery](https://www.aspsnippets.com/Categories/jQuery.aspx).
Adding the Data Rows
A loop is executed over the Array elements and one by one a Row is created in the HTML Table.
Table insertRow Method : This method adds a new row to a Table at the specified index. If the index is supplied as -1 then the row will be added at the last position.
Then inside each Row, a dynamic Cell element is created and appended using [jQuery](https://www.aspsnippets.com/Categories/jQuery.aspx).
Adding the dynamic Table to the Page
Finally, the dynamically created table is added to the page by appending it to the HTML DIV using the append method.
**Note**: You can also append an element to the body but then you won’t be able to set its placement on the page. Using a container such a DIV helps us add the dynamic element to the desired place.
\<script type\="text/javascript" src\="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"\>\</script\>
\<script type\="text/javascript"\>
\$(function () {
\$.get("https://raw.githubusercontent.com/aspsnippets/test/master/Customers.json", function (data, status) {
var customers = JSON.parse(data);
//Create a HTML Table element.
var table = \$("\<table /\>");
table\[0\].border = "1";
//Add the header row.
var row = \$(table\[0\].insertRow(-1));
//Add the header cells.
var headerCell = \$("\<th /\>");
headerCell.html("CustomerId");
row.append(headerCell);
var headerCell = \$("\<th /\>");
headerCell.html("Name");
row.append(headerCell);
var headerCell = \$("\<th /\>");
headerCell.html("Country");
row.append(headerCell);
//Add the data rows.
for (var i = 0; i \< customers.length; i++) {
//Add the data row.
var row = \$(table\[0\].insertRow(-1));
//Add the data cells.
var cell = \$("\<td /\>");
cell.html(customers\[i\].CustomerId);
row.append(cell);
cell = \$("\<td /\>");
cell.html(customers\[i\].Name);
row.append(cell);
cell = \$("\<td /\>");
cell.html(customers\[i\].Country);
row.append(cell);
}
var dvTable = \$("\#dvCustomersGrid");
dvTable.html("");
dvTable.append(table);
});
});
\</script\>
**Screenshot**

**Browser Compatibility**
The above code has been tested in the following browsers. ![Internet Explorer]() ![FireFox]() ![Chrome]() ![Safari]() ![Opera]()
\* All browser logos displayed above are property of their respective owners.
**Demo**
**Downloads** |
| Shard | 173 (laksa) |
| Root Hash | 15149566428044961973 |
| Unparsed URL | com,aspsnippets!www,/Articles/3658/Populate-Table-from-API-using-jQuery/ s443 |