相关疑难解决方法(0)

通过Jquery AJAX传递PHP变量

我正在尝试学习Jquery AJAX函数,但我正在努力研究如何将PHP变量传递到我的主文档中.

这就是我目前拥有的:

<script>
  var refreshId = setInterval(function() {
    $.ajax({
      url: "test.php",
      dataType: "json", //the return type data is jsonn
      success: function(data){ // <--- (data) is in json format
        $('#testdiv').html(data.test1);
        $('#testdiv').append(html(data.test2));
        //parse the json data
      }
    });

}, 1000);
</script>
Run Code Online (Sandbox Code Playgroud)

php variables ajax jquery

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

ajax ×1

jquery ×1

php ×1

variables ×1