Hi guys,
I need some help with a javascript code to refresh specific views from a page and not the hole page after 30 secs.
Can anyone help me with it?
Thanks!
Hi guys,
I need some help with a javascript code to refresh specific views from a page and not the hole page after 30 secs.
Can anyone help me with it?
Thanks!
From a quick glance it looks like you need to move this: Knack.views["view_1111"].model.fetch();
into the setTimout function
Also, fetch only works on tables. not sure what kind of view view_1111 is for you. If it's a form it will not work.
Another forum user points to another method to refresh form elements in this thread but I couldn't get it to work.
I dont know to JS, so can you tell me what's wrong with my code? I really need to set a timer to refresh:
$(document).on('knack-scene-render.view_1111', function(event, view, record) {
Knack.views["view_1111"].model.fetch();
function refresh()
{
setTimeout( function() {
$('#view_1111').fadeOut('slow').load('load.php').fadeIn('slow');
refresh();
}, 10000);
}
});
Try Knack.views["view_1118"].model.fetch();
I have found this code above, but it dont really reload the views I selected. Does anyone know what should I change to make those views to actually reload not making the hole page reload?
$(document).ready( function(){
$('#view_1118,#view_1111').load('load.php');
refresh();
});
function refresh()
{
setTimeout( function() {
$('#view_1118,#view_1111').fadeOut('slow').load('load.php').fadeIn('slow');
refresh();
}, 10000);
}