jQuery ajax实现

来源:互联网 发布:华为面试题 2017 java 编辑:程序博客网 时间:2024/06/17 21:43
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <title>toggle方法</title>    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">    <meta http-equiv="description" content="this is my page">    <meta http-equiv="content-type" content="text/html; charset=UTF-8">      <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script><link rel="stylesheet" type="text/css" href="./css/style.css" /><script type="text/javascript">$(function(){$("#ajaxbutton").bind("click",function(){$.ajax({url:"ajaxServlet",type:"post",//请求类型data://"username=zhangsan&age=19&password=1234",{username:"马云",password:"1234",age:18},timeout:"5000",success:function(data){alert(data);},error:function(){alert('出错');}});})})</script>  </head>  <body>  <input id="ajaxbutton" type="button" value="ajax调用">  </body></html>

原创粉丝点击