ajax無重新整理提交

來源:互聯網
上載者:User

標籤:

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>

 

ajax無重新整理提交

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.