返回首页 我的新博客

最简单jquery.ajax+php例子(对话框显示文本框输入内容),以小见大(初学手记)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  
<head>
    
<title>Hello Jq</title>
    
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
<script language="javascript" src="js/jquery-1.3.2.js"></script>
    
<script language="javascript">
        
function GetUserNameValues(strValue)
        {
            $
.get("ajax.php", {value:strValue}, function(text){
                alert(text);
            });
        }
    
</script>
  
</head>
  
<body>
      
<form name="form" method="POST">
          
<div style="text-align:center;margin-top:20%;">
          
<table>
              
<tbody>
                  
<tr>
                      
<td><input type="text" id="txtName" name="txtName" value="" onblur="return GetUserNameValues(this.value);"/></td>
                  
</tr>
              
</tbody>
          
</table>
          
</div>
      
</form>
  
</body>
</html>

ajax.php

<?php
echo $_GET['value'];
?>
posted @ 2010-11-06 13:05  buffer的blogs  阅读(288)  评论(0编辑  收藏  举报