how to execute any function in jquery after few seconds on the click of any link
- by james Bond
I have struts2 jquery grid where on click of a row I am calling a jQuery function for performating a struts2 action. My code is running fine.
I want to perform my jQuery function after delay of a few seconds. How can I do this?
<script type="text/javascript">
//assume this code is working fine on rowselect from my jquery grid, New Updation in it is "i want to execute or load the url after few seconds"
$(function(){
$.subscribe('rowselect', function(event,data) {
var param = (event.originalEvent.id);
$("#myAdvanceDivBoxx").load('<s:url action='InsertbooksToSession' namespace='/admin/setups/secure/jspHomepage/bookstransaction'/>'+"?bid="+event.originalEvent.id);
});
});
</script>
What i tried is the below code but am unable to get the output which i am looking for:
<script type="text/javascript">
$(function(){
$.subscribe('rowselect', function(event,data) {
var param = (event.originalEvent.id);
$("#myAdvanceDivBoxx").load('<s:url action='InsertbooksToSession' namespace='/admin/setups/secure/jspHomepage/bookstransaction'/>'+"?bid="+event.originalEvent.id);
}).delay(9000);
});
</script>