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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Memento
NA
111
133.3k
How to reload a div using php & ajax
Aug 14 2012 12:05 PM
Confused about ajax story
$images=array("img01.png", "img02.png", "img03.png");
<div id="imgBox">
<?php
echo "<img onclick='reload()' src=\"img/".$images[0]."\">";
echo "<img onclick='reload()' src=\"img/".$images[1]."\">";
echo "<img onclick='reload()' src=\"img/".$images[2]."\">"; ?>
</div>
onclick - I want to shuffle $images on server side, and then rewrite #imgBox
<script type="text/javascript">
function reload(){
var content=document.getElementById("imgBox").innerHTML;
var url="shuffle.php";
postRequest(url);
}
function postRequest(){
var xmlHttp;
if (window.XMLHttpRequest) {
var xmlHttp = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttp.open('POST', strURL, true);
} // I know - something is wrong here.
</script>
shuffle.php:
$content = shuffle($images);
echo "<img onclick='reload()' src=\"img/".$images[0]."\">";
echo "<img onclick='reload()' src=\"img/".$images[1]."\">";
echo "<img onclick='reload()' src=\"img/".$images[2]."\">";
very strange - nothing happend :))
Please help.
Reply
Answers (
0
)
ModalpupupExtender control
How To Enable Ajax Toolkit Vs-2008??