惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
The Register - Security
The Register - Security
量子位
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
MyScale Blog
MyScale Blog
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
Jina AI
Jina AI
博客园 - 【当耐特】
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
宝玉的分享
宝玉的分享
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
有赞技术团队
有赞技术团队
T
Tor Project blog
H
Hacker News: Front Page
A
Arctic Wolf
NISL@THU
NISL@THU
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
V
V2EX
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
I
InfoQ
D
Docker
L
LINUX DO - 最新话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42

博客园 - Stym--闫生

最简单的silverlight的DataGrid行双击事件添加 == 在cmd命令下imp oracle dmp文件 flex TabNavigator 切换之前给出提示 - Stym--闫生 vb.net连接oracle和php连接oracle - Stym--闫生 - 博客园 数据库名,全局数据库名,SID 创建同义词和赋权限 linux下创建硬连接 flex 的as文件引用,包引用 - Stym--闫生 - 博客园 flex分页控件 - Stym--闫生 - 博客园 数据处理:等待条 把数组转化成一个xml字符串--php - Stym--闫生 - 博客园 javascript拖住布局demo flex + Amfphp + mysql +IIS 5.1t 用sql查看表结构 c#生成验证图片 C#使用sql语句读取excel文件数据 svn切换用户,报“501 Method Not Implemented”错误 div滤镜结合ajax,实现登录
php使用ajax技术
Stym--闫生 · 2008-11-25 · via 博客园 - Stym--闫生

一:html文件(yans.html)

<META http-equiv=content-type content='text/html; charset=utf-8'/>
<META http-equiv=pragma content=no-cache>
<META http-equiv=expires content=0>
</HEAD>
<BODY>
 <input type="button"  name="TEST"  value =" click" onClick="post();">
</BODY>
<script language="javascript" type="text/javascript">
 
 //处理send_request返回信息的函数,使用AJAX时统一调用此函数
 var http,http_return;
 function checkRequest() {
  if (http.readyState==4 && http.status==200) { // 判断对象状态,信息已经成功返回,开始处理信息
   http_return = http.responseText;
  }
 }
 function post()
 {
  try{
   http= new ActiveXObject("Msxml2.XMLHTTP");
  }catch(e)
  {
   try{
    http= new ActiveXObject("Microsoft.XMLHTTP");
   }catch(e)
   {
    alert("create requestHTTP false!");
    return ;
   }
  }
  // escape(),encodeURI();
  http.open("POST","AJax.php?name="+encodeURI("闫生"),true);

  //只有是post提交的时候使用,下面一句话。get不要
  http.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  http.onreadystatechange = checkRequest;

  // 这句话话如果是get提交的话,就发送null即可

 // post提交的时候,相当于提交一个form
  http.send("sex=按钮");
  alert(http_return);
 }
</script>
</HTML>

二:ajax文件(AJax.php)

<?php
function fn_getParam($sSource,$sReplace="")
  {
    $sValue="";
    if (isset($_GET[$sSource])) {
        $sValue = $_GET[$sSource];
    } else if (isset($_POST[$sSource])) {
        $sValue = $_POST[$sSource];
    }
    if (is_null($sValue) || $sValue=="") {
        return $sReplace;
    }
    return $sValue;
  }
$a = fn_getParam('name','yans');
// 打开文件,获得句柄
$handle = fopen('test.txt', 'w+');
// 写入文件
fwrite($handle,$a);

// 关闭文件
fclose($handle);

// 返回ajax操作结果。
echo $a;
?>