07.Ajax.post

 <title>07.Ajax.post</title>
    <script src="myAjax2.js"></script>
    <script>
        window.addEventListener(load, function() {
            var btn = document.querySelector(button);
            btn.onclick = function() {
                Ajax(POST, 07.Ajax.post.php, { // 调用自己封装的 Ajax方法
                    name: hellow hellow,
                    age: 17岁呀
                }, 3000, function(xhr) {
                    alert(xhr.responseText);
                }, function(xhr) {
                    alert(error);
                })
            }
        })
    </script>
</head>

<body>
    <button>提交请求</button>
</body>
<?php
echo $_POST[‘name‘];
echo ‘<br>‘;
echo $_POST[‘age‘];
?>

 

07.Ajax.post

上一篇:php导出excel表格超链接


下一篇:websocket测试工具的环境搭建与使用