If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
-
devedix
- Veteran Member
- Posts: 30
- Joined: 2021-04-20 10:44
Post
by devedix » 2021-06-26 09:27
Hi all,
I tried to follow the Appgini course on calculated field that can automatically sum the subtotal but the setInterval function is not running.
But when I refresh the page the value is updated.
This is my code
Code: Select all
if ($j('[name=SelectedID]').val().length) setInterval(update_order_total, 5000);
update_order_total();
function update_order_total() {
$j('#OrderTotal').load('hooks/ajax-order-total.php', { id: $j('[name=SelectedID]').val() });
}
I am using Appgini version 5.97
Can anyone help me to find out what's wrong with this.
Thanks
Regards,
Edix
-
pbottcher
- AppGini Super Hero
- Posts: 1635
- Joined: 2018-04-01 10:12
Post
by pbottcher » 2021-06-26 10:39
Hi,
try to use the name in quotes
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
-
bwalker
- Posts: 13
- Joined: 2021-05-24 22:30
Post
by bwalker » 2021-07-05 18:22
Is this code within the Doc ready function? ( $j(function(){ )
-
bwalker
- Posts: 13
- Joined: 2021-05-24 22:30
Post
by bwalker » 2021-07-05 18:36
you could add this as the first line in the 'update_order_total' function, save the file and refresh the order detail page.
alert('in update_order_total function');
You should get this alert every 5 seconds. At least you will know that the function is getting triggered every 5 seconds.
if still not working the issue may be in the 'ajax-order-total.php' page.
-
devedix
- Veteran Member
- Posts: 30
- Joined: 2021-04-20 10:44
Post
by devedix » 2021-07-16 06:34
Hi Guys,
Thanks for the help and sorry for the slow response.
I already figure out the problem.
The setInterval function only runs when I set the field as read-only from Appgini but won't work if I set read-only using Jquery.
Regards,
Edix