• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How do I refresh a DIV content?

javascriptphpjqueryhtml


PHP Snippet 1:

function updateDiv()
{ 
    $( "#here" ).load(window.location.href + " #here" );
}

PHP Snippet 2:

$("#yourDiv").load(" #yourDiv > *");

PHP Snippet 3:

<script> 
$(document).ready(function(){
setInterval(function(){
      $("#here").load(window.location.href + " #here" );
}, 3000);
});
</script>

<div id="here">dynamic content ?</div>

PHP Snippet 4:

$('#yourDiv').load('#yourDiv > *')

PHP Snippet 5:

$.get("/YourUrl", {},
      function (returnedHtml) {
      $("#here").html(returnedHtml);
});

Related Snippets

How do I pass the dynamic output of a php variable or php function to a CSS variable?

php mysql + create a friend request system

Dropzone: Submit both form data and dropzone at once

CodeIgniter 3 is generating a session file on each request, why?

Xdebug 3 not showing in phpinfo on m1 Monterey

How to loop a tree array with unknown depth and get array blocks?

Unable to create lockable file - Laravel 8 & PHP 8

Can we define variables in `.tpl` files?

CONCAT columns with Laravel 5 eloquent

Pass an image through AJAX [duplicate]

Phalcon: setStatusCode returns empty response

MySQL default time format UTC or GMT?

How can I pass the list to the component variable in Laravel?

How to use React Router with Laravel?

Add rows to Single product Additional information table in WooCommerce 3.6

About Contact Privacy policy Terms and conditions