当mySQL数据库被更新时,我需要我的文本自动更新。有人能帮忙吗?我看了很多东西,没有一篇文章说我需要什么,我是刚接触过阿贾克斯的,对此不太了解。我只知道HTML,CSS,PHP和javascript。
发布于 2012-06-13 02:57:03
首先,您可能需要检查jQuery。如果您了解javascript,这将非常简单,并且会使您的开发更加容易。
然后,您需要检查ajax调用是如何用jQuery实现的。同样,非常简单,下面是一个例子。
test.php
$var1 = $_POST['key'];
$var2 = $_POST['key1'];
//Some code here
echo 'Test finished'; // This is returned to the ajax callJAVASCRIPT
$.ajax({
url: '/test.php',
type: 'POST', /*Method, POST or GET depending on your needs*/
async: true, /*This makes the ajax call asyncronously or not*/
data: {'key':value,'key2':value2},/*data to send*/
success: function(result){ /*Return from PHP side*/
/* result contains the data replied from the PHP script. */
alert(result);
}
});如果您想替换HTML的某些部分,您可能需要检查函数,如追加、之后、在此之前、占优势和html等。另外,也要了解关于JSON的一些知识,这是一种数据格式。很简单,但又很壮丽
希望这对你有帮助!这看起来像家庭作业,但你很快就会成功的,你会看到的。
https://stackoverflow.com/questions/11007467
复制相似问题