refresh div jquery code example
Example 1: jquery reload page
$('#myElement').click(function() {
location.reload();
});
Example 2: How can I refresh a page with jQuery
$('#something').click(function() {
location.reload();
});
Example 3: reload page jquery
location.reload();
Example 4: refresh div jquery
$("#mydiv").load(location.href + " #mydiv");
//this is actualy not so nice but it does the job.
Example 5: refresh a div jquery
$(document).ready(function(){
$(function(){
$('#ideal_form').submit(function(e){
e.preventDefault();
var form = $(this);
var post_url = form.attr('action');
var post_data = form.serialize();
$('#loader3', form).html('<img src="../../images/ajax-loader.gif" /> Please wait...');
$.ajax({
type: 'POST',
url: post_url,
data: post_data,
success: function(msg) {
$(form).fadeOut(800, function(){
form.html(msg).fadeIn().delay(2000);
});
}
});
});
});
});
Example 6: AJAX in reload a div container
(function($)
{
$(document).ready(function()
{
$.ajaxSetup(
{
cache: false,
beforeSend: function() {
$('#content').hide();
$('#loading').show();
},
complete: function() {
$('#loading').hide();
$('#content').show();
},
success: function() {
$('#loading').hide();
$('#content').show();
}
});
var $container = $("#content");
$container.load("rss-feed-data.php");
var refreshId = setInterval(function()
{
$container.load('rss-feed-data.php');
}, 9000);
});
})(jQuery);