亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

使用jquery實(shí)現(xiàn)簡單的ajax

 更新時(shí)間:2013年07月08日 09:20:32   作者:  
本篇文章是對(duì)用jquery實(shí)現(xiàn)簡單的ajax的實(shí)現(xiàn)方法進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
-->html頁
復(fù)制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
      <title>用戶名校驗(yàn)實(shí)例</title>
      <script src="../js/jquery-1.7.2.js" type="text/javascript"></script>
      <script src="../js/verify.js" type="text/javascript"></script>
  </head>
  <body onload="verify()">
  用戶名校驗(yàn)的jax實(shí)例
  <!--ajax方式下不需要使用表單進(jìn)行數(shù)據(jù)提交,因此不用寫表單-->
  <input type="text" value="" id="userName" />&nbsp;
  <input type="button" value="提交" onclick=""/>
  <!--預(yù)留空間,顯示結(jié)果-->
  <div id="result"></div>
  <!--div is block,but span is inline--->
  </body>
  </html>

—>js頁
復(fù)制代碼 代碼如下:

function verify() {
      $("#userName").keyup(function () {
          var user = $(this).val();
          var userobj = $(this);
          $.post("../index.aspx", { userobj: user }, callback);
      });

  }
  function callback(data) {
      $("#result").text(data);
  }

—>aspx頁
復(fù)制代碼 代碼如下:

<%
  Response.Clear();
  string str_name = Request["userobj"];
  if (str_name == "xtyang")
  {

      Response.Write("ok");
  }
  else
  {
      Response.Write("no");
  }
  Response.End();     
  %>

相關(guān)文章

最新評(píng)論