Refresh div in real time with php / javascript without updating page

0

My question is as follows, assuming I have a div and in this div I have a php code that says that when someone enters the page it sends a curl. What I basically want to know is if there is any way for this div to be constantly upgraded to badly I change a thing display or x in x milliseconds send the curl.

Thank you

    
asked by anonymous 23.10.2015 / 15:12

1 answer

-2

PHP is Server Side and Javascript is Client Side. There is no way to run php script 'on the fly'.

You need to run Ajax when you want this CURL to run.

See if this helps you:

$("button").click(function(){
    $.ajax({
         url: "demo_test.txt", 
         success: function(result){
              $("#div1").html(result);
         }
         });
});
    
23.10.2015 / 16:59