2
Hello, I just want an example for study purposes. I want the page to update automatically, for future chat, the page update asynchronously and also to update page in real time, where other people from the computer can see the data at the same time. All with enough doubt in Ajax with Jquery, so I am asking the question. My question is related to function...
i have the test.php file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
</style>
</head>
<body>
<div id="atualizar-assincrona"></div>
<script type="text/javascript" src="jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="ajax.js"></script>
</body>
</html>
I have the ajax.php file
$(function(){
$.ajax({
url: "ajax.php", // substitua por qualquer URL real
async: true
}).done(function () {
a = true;
});
});
Sorry but I do not know very well to use this function, I need only a simple function to is updating the data without the user noticing. It could be anyone, but I understand Jquery but there are few subjects that teaches about ajax.
Update can be every 2 seconds...
Out of curiosity, have you read the documentation function? If yes, you can edit the question and add what are the real questions?
– Woss
First @Alan the file code
ajax.php
will not run as you are trying to runjavascript
inside a file.php
.– Godfrey the King
async: true
is the initial value even if you do not indicate it. Easync: false
was removed from jQuery because it was a bad idea. I also don’t understand the question, you can explain better?– Sergio