我正在尝试在数据库中有新内容时仅在页面上重新加载div
标记
在Ajax中我测试新内容:
function adshandler() {
var d = new Date();
var cache = d.getTime();
$.getJSON("check_time.php?cache=" + cache, function(update) {
if (update.count === true) {
//location.reload();
$('#slideshow').reload();
}
});
}
setInterval(adshandler, 10000);
div
与ajax在同一页面上:
//Monday Afternoon
if ($dayofweek == "Monday" && $timeofday >= "12:00:00" && $timeofday <= "16:59:59"){
//Monday afternoon timeslot
echo "<div id='slideshow'>";
$stma= $conn->prepare("SELECT `Monday_Afternoon`
FROM `Client_Ads`");
$stma->execute();
while($resultst = $stma-> fetch()){
$mondayafternoonlist = $resultst["Monday_Afternoon"];
echo "<div class='slideshow'>";
echo "<img src='/$mondayafternoonlist'>";
echo "</div>";
}
echo "</div>";
}
有div with a similar
个and
个, each one behind an
个and
个$('#slideshow').reload();
个{if}} if if语句,具体取决于星期几等。
我的$('#slideshow').load();
无效?
我也试过- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:@"showRecipeDetail" sender:[YOUR_ARRAY objectAtIndex:indexPath.row]];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"showRecipeDetail"])
{
member_details *destViewController = segue.destinationViewController;
destViewController.hello = sender;
}
}
。
答案 0 :(得分:1)
答案 1 :(得分:0)
function adshandler() {
var d = new Date();
var cache = d.getTime();
$.getJSON("check_time.php?cache=" + cache, function(update) {
if (update.count === true) {
//location.reload();
$("#slideshow").load(location.href + " #slideshow");
}
});
}
setInterval(adshandler, 10000);