Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
3 replies Latest Post - ‏2014-09-20T11:44:05Z by jitupkp
Pasterstroodle
Pasterstroodle
1 Post
ACCEPTED ANSWER

Pinned topic Ajax Loading Problem

‏2012-03-21T22:41:29Z |
The following code succesfully refreshes the #content div, but in doing so it clear the $name variable which is passed from a previous page. How can I reload the div without losing my variable? The following is the code in "thispage.php". Any help would be appreciated!

<html>
<head>

<script>
setInterval(function() {
$('#content').load('thispage.php #content');
}, 3000);
</script>

</head>
<body>

<?php

include 'php/db.php';

$name = $_POST;
echo '<div id="content">';

$ad= mysql_one_data("SELECT ad FROM tab1 WHERE name = '$name'");

echo 'Address ' .$ad. ' <br>';

echo '</div>';

?>

</body>
</html>
Updated on 2012-03-22T08:09:35Z at 2012-03-22T08:09:35Z by zeronc