jQuery DIV Auto Load and Refresh
jQuery DIV Auto Load and Refresh
jQuery load() Method
Description: Load data from the server and place the returned HTML into the matched element.Syntax: .load( url [, data ] [, complete ] )
-
urlType: String, A string containing the URL to which the request is sent.
-
dataType: String, A plain object or string that is sent to the server with the request.
-
completeType: Function( String responseText, String textStatus, jqXHR jqXHR )A callback function that is executed when the request completes.
You may also like - Node Js Interview Questions And Answers****************************************************************************
$(document).ready(function(){
setInterval(function(){
$("#mydiv").load('load_data.php')
}, 5000);
});
- The PHP file load_data.php is requested via jQuery ajax using load method.
- The above code will run every 5 seconds and will update data in div with ID- mydiv