TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Load Page in a Div using Ajax with JQuery in PHP
Vinod Verma
Nov 08
2014
Code
2.9
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
page load.zip
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<title>Test</title>
<script type=
"text/javascript"
>
window.onclick =
function
() {
document.getElementById(
"aside"
).innerHTML =
"<img src='loadingImage.gif'>"
;
if
(XMLHttpRequest)
var
x =
new
XMLHttpRequest();
else
var
x =
new
ActiveXObject(
"Microsoft.XMLHTTP"
);
x.open(
"GET"
,
"other_page.php?aa=1&bb=4&cc=6"
,
true
);
x.send(
""
);
x.onreadystatechange =
function
() {
if
(x.readyState == 4) {
if
(x.status == 200) document.getElementById(
"aside"
).innerHTML = x.responseText;
else
document.getElementById(
"aside"
).innerHTML =
"Error loading document"
;
}
}
}
</script>
</head>
<body>
<div id=
"aside1"
onclick=
"asd()"
>This is aside</div>
<div id=
"aside"
></div>
</body>
</html>
Load page in a div using ajax with Jquery in php with page loader