Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,
i need to get the innerHtml details of a page .in the below script when i alert the obj iam getting the Text of Html i need to get the inner html object how it is possible.
kindly correct the below code i need to take the Form of html with ID=form3

function GetPage() {

           $.ajax({
               url: "Page1.aspx",
               type: "Post",
               async: false,
               data: { "param": "abcd"
               },
               success: function(obj) {




               }
           });



//HTML
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<script language=javascript>
    alert('ggg');
</script>
<body id="bd" bgcolor="#ff9999">
    <form id="form3" runat="server">
    
  <div id="dynamic"> </div>
    <asp:TextBox ID="TextBox1" runat="server">
    <asp:Button ID="Button1" runat="server" Text="Button" />
 <div id="mainremoved" style="width:100%">  This is Home content </div>
    </form>
</body>
</html>
Posted
Updated 7-Oct-11 23:35pm
v2

Take a look at the following:
jQuery HTML Manipulation[^]
and
Jquery HTML() vs InnerHTML()?[^]

Those two links should enable you to solve your problem :)

Best regards
Espen Harlinn
 
Share this answer
 
Comments
sajithnet 8-Oct-11 6:59am    
thanks for ur help.my problem is that iam getting the html condense in
function(obj) from that i need to extract the div id="dynamic"
Espen Harlinn 8-Oct-11 7:07am    
By condense you mean it's a string containing the html? If so, you most insert it into the dom before you can use the dom functionality to inspect the html, or just search the string for 'id="whatever"' end extract whatever directly from the string.
sajithnet 8-Oct-11 7:57am    
can u give the code for that
sajithnet 8-Oct-11 8:07am    
or just search the string for 'id="whatever"' end extract whatever directly from the string. can u share the code
You can filter it before extracting the page.
Use below code and let me know if it works or not.
JavaScript
function GetPage() {
 
            $.ajax({
                url: "Page1.aspx div#dynamic",
                type: "Post",
                async: false,
                data: { "param": "abcd"
                },
                success: function(obj) {
                                 
                    //here you will get the div with id dynamic only.
                 
      
                }
            });
 
Share this answer
 

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