Importing a div's content from a Static HTML file using PHP or jQuery or Ajax?
Posted
by
Vikram
on Stack Overflow
See other posts from Stack Overflow
or by Vikram
Published on 2010-12-28T17:46:18Z
Indexed on
2010/12/28
17:53 UTC
Read the original article
Hit count: 196
Hello friends a newbie question...
The Issue is like this:
I have a static HTML file and I want to import just a portion of that file into another page. How can I do that.
Example Code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Some title here</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<div id="box-1">
<div class="block">
<!-- Some code here -->
</div>
</div>
<div id="box-2">
<div class="block">
<!-- Some code here -->
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="script.js"></script>
</body>
</html>
Now what I want is to read this HTML file and import just this bit:
<div id="box-1">
<div class="block">
<!-- Some code here -->
</div>
</div>
Is there a way of doing it?
Kindly help.
Even a PHP, jQuery, Ajax or any other solution will also do. Please help me.
© Stack Overflow or respective owner