Jquery学习笔记之ajax
2011-03-31 21:11
447 查看
前几天一直都在了解xhtml+div+css 后来做出来的网页效果也不是很如意,但是总是算完成了作业。今天开始学jquery+ajax页面先后传值。
用户名:
密码 :
邮箱:
您还没有注册?next
准备明天用jquery+ajax实现对页面的元素的操作。忘了,有一个问题没解决,怎么把msg返回到页面上显示出来,json对象是怎么遍历的了。。
用户名:
密码 :
邮箱:
您还没有注册?next
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css" mce_href="styles.css"> --> <mce:script type="text/javascript" src="jquery-1.4.min.js" mce_src="jquery-1.4.min.js"></mce:script> <mce:script type="text/javascript"><!-- //jquery 你得这么写: $(function(){ alert("ok?"); $(":input[type='button']").click(function(){ //传输数据 val()获得第一个匹配元素的当前值 var $param = "username="+$("#username").val()+"&password="+$("#password").val(); $.ajax({ url:'login.action', data:$param, type:'post', dataType: 'json', success :function(msg){ var o = eval(msg);//将json字符串转换成js对象 alert(o); } }); }); }) // --></mce:script> </head> <body> 用户名:<input name="username" type="text" id="username"/><br> 密码 :<input name="password" type="password" id="password"><br> 邮箱:<input name="email" type="text" id="email"/><br> <input type="button" value="提交" id="submit"/> <span>您还没有注册?</span><a href ="regist.jsp">next</a> </body> </html>
准备明天用jquery+ajax实现对页面的元素的操作。忘了,有一个问题没解决,怎么把msg返回到页面上显示出来,json对象是怎么遍历的了。。
相关文章推荐
- Jquery学习笔记——Ajax
- jQuery学习笔记四(jQuery - AJAX)
- Ajax基础学习笔记三—jQuery实现Ajax
- 【jQuery学习笔记-----AJAX之jQuery角度分析】
- JavaScript权威设计--jQuery,Ajax.animate,SVG(简要学习笔记二十)[完结篇]
- Jquery学习笔记 --ajax删除用户,使用了js原生ajax
- jquery中ajax学习笔记一
- jQuery学习笔记:Ajax(一)
- jquery学习笔记之Ajax应用(内含jquery十一天学习笔记链接)
- 20151223jquery学习笔记--Ajax表单提交
- 【jQuery学习笔记】关于jQuery1.6.1版的ajaxstart不执行问题解决方案
- jQuery 学习笔记四 Ajax提交数据
- AJAX 学习笔记[七] AJAX 与JQuery 框架
- 【jQuery】jQuery官方基本教程的学习笔记4-异步Ajax
- jQuery学习笔记之Ajax在jQuery中的应用
- 【jQuery学习笔记--------AJAX之jQuery角度分析】
- 黑马程序员之 ASP.NET学习笔记:jquery+ajax无刷新分页代码
- JQuery学习笔记 [Ajax] (6-1)
- j2ee学习笔记之前端(js、jQuery、html、html5、webService、ajax、css)—— 一直会补充
- JQuery学习笔记(2):Ajax的load方法