Я искал, чтобы увидеть, есть ли здесь аналогичный пост, и если кто-то находит его извиняющимся за дубликат.
Итак, моя дилемма такова:
Учитывая код нижепочему это моя возвращенная загрузка данных и затем исчезающий?
CSS
#contentbg{
background-image: url(../images/jp_01.jpg);
background-repeat: no-repeat;
background-position: top;
position: absolute;
width: 755px;
height: 629px;
}
#content{
position: relative;
}
JS
function getHome(){
$.post("php/functions.php?s=home",
function(data) {
$('#content').html(data);
});
};
HTML
<div id="contentbg">
<div id="content"></div>
</div>
<ul id="navlist">
<li id="home"><a href="index.php" onClick="getHome();" title="Home"></a></li>
</ul>
PHP
function displayHome($home){
if(isset($home)){
$home = '<img src="images/home.jpg" alt="Home" width="755" height="630" />';
return $home;
}
}
if (isset($_GET['s'])) {
switch ($_GET['s']) {
case "home":
echo displayHome($_GET['s']);
break;
}
}
Я знаю, что данные загружаются, если я изменяю JS, как показано ниже:
function getHome(){
$.post("php/functions.php?s=home",
function(html) {
alert("Data Loaded: " + html);
});
};