Thursday, October 25, 2012

jQuery Load HTML Response Example

The jQuery Load() ajax method supports HTML and Text type responses sent by the server. In this post we shall see on how to process HTML data returned from the server using the jQuery Load() method.

The syntax for receiving and processing HTML response is as follows.

$("#<Target HTML element ID>").load("<Server URL>");

The following example receives a HTML format data from the server and displays the data in a DIV tag in the browser.

.aspx Page (Client Side)
<html xmlns="" >
<head runat="server">
    <title>jQuery Ajax Load</title>
    <script type="text/javascript" src="JavaScript/jquery-1.7.2.js"></script>
        $(document).ready(function() {
            // Get HTML Response data from the Server
            $('#btnGetHTML').click(function(event) {
    <form id="frmAjax" runat="server">
    <table border="1">
            <tr valign="middle">
                        Text="Get HTML" />
                <td align="center">
                    <br /><div id="divHTML"></div> 

.AjaxData.html (Server Side)

<table border="1">
        <td>125. E.Spring Creeks, OH</td>
        <td>121 Highway, Plano TX</td>

Search Flipkart Products:

No comments: