Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
$(document).ready(funtion(){
    $('#btn').click(funtion(){   
        $('#div_content').load(html.page);
     });
});


Above coding only i used. but the page not loading into div tag.

Pls help me.. (javascript or Jquery)..
Posted
Updated 7-Feb-17 19:19pm
Comments
Sandeep Mewara 10-Mar-13 3:20am    
"html.page" is a URL or Data or what?
hari301 10-Mar-13 3:35am    
i want load the content from "load.html", i mean what the html page contains.
Prasad Khandekar 10-Mar-13 14:32pm    
Hello Hari,

According to JQuery API doc your code should work, provided div_content exists and is visible and that html.page represents a valid url. Have a look at http://api.jquery.com/load/

Hari301,

I had a same problem once and when I tried the below code it was working fine for me.

Main page:

HTML
<!DOCTYPE html>
<html>
<head>
  <style>
  body{ font-size: 12px; font-family: Arial; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>

<b>Successful Response (should be blank):</b>
<a href="#" onclick="check();">click me</a>
<div id="success"></div>
<b>Error Response:</b>
<div id="error"></div>
<div id="b"></div>

<script>

function check(){
$('#b').load('test.html #target');
}
  </script>

</body>
</html>


Page from which we need to load the content

HTML
<html>
<head></head>
<body>
<div id='target'>
 I am from test page.
</div>
</body>
</html>
 
Share this answer
 
v2
Comments
hari301 12-Mar-13 9:12am    
Ya its working.. Really thank u so much senthil.
sri senthil kumar 13-Mar-13 3:11am    
you're welcome
parvez11 23-Apr-13 7:55am    
hi,,
i want to target whole aspx page..
how can i load it into div.
sri senthil kumar 25-Apr-13 2:04am    
You can load with above method itself, if u have a wrapper div in aspx page.
ijaz4u 22-May-13 3:06am    
hi,
i have loaded html in a div element and i want to overwrite div with new html page what should i do??
$(document). ready(function(){
$("#any button id or href id"). click(function(){

$("#id of the div tag where you want to add the entire page"). load ("myFile.jsp");
});

});
 
Share this answer
 
Comments
guradio 5-Aug-14 22:57pm    
how can you load two pages with just one click of a link..i want to load two pages in two separate div how is this possible
How to load external or internal CSS files?
 
Share this answer
 
Comments
CHill60 8-Feb-17 12:36pm    
This is not a solution to the question posed. If you have a question of your own then use the  Ask a Question  link above. You will need to include a lot more information than this

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