zoukankan      html  css  js  c++  java
  • ajax无刷新提交

    AJAX即“Asynchronous Javascript And XML”(异步JavaScript和XML),是指一种创建交互式网页应用的网页开发技术。

    先创建两个文件,一个作为服务器端页面文件,一个作为web端页面文件。

    分别是ajax.php,ajax.html.

    ajax.php

    <?php 
        $fp = fopen("./02.txt","a");//打开一个文件
        fwrite($fp,"PHP_ _ _");//往打开的文件里面写入“PHP_ _ _”
        fclose($fp);
    ?>

    ajax.html

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
        function f1(){
            //利用ajax请求ajaxfile.php
            //1,创建ajax对象
            var xhr = new XMLHttpRequest();
            //2.创建新的http请求
            xhr.open('get','./ajax.php');
            //3.发送请求
            xhr.send(null);
        }
    </script>
    </head>
    
    <body>
        <h2>ajax对服务器发送请求</h2>
        <input type="button" value="触发" onclick="f1()"/>
    </body>
    </html>
  • 相关阅读:
    逛画展
    数的划分
    有点难度的树链刨分
    树链刨分
    记502 dp专练
    数论相关
    模拟退火
    仓鼠找sugar
    NOIP 2017 解题报告
    整体二分
  • 原文地址:https://www.cnblogs.com/invban/p/4813372.html
Copyright © 2011-2022 走看看