I am having trouble attaching a timing event to my function I want this to on execute the function after 25 seconds. what am I doing wrong?
setTimeout("ajaxTimeout();", 25000);
$(document).on({
//open popup here
'pageshow': function ajaxTimeout(){
$('#askforsomething').popup('open');
}
}, '#homepage');
Two points:
$(document).ready(function () { ... })
. Alternatively, a shorthand for this is simply $(function () { ... })
.setTimeout
instead of a code string.Result:
$(function () {
setTimeout(function () {
$('#askforsomething').popup('open');
}, 25000);
});