jq代码学习21----- ajax serialize( )
来源:互联网 发布:优化客户对策 编辑:程序博客网 时间:2024/05/08 17:11
serialize( )作用于jq对象,将DOM元素内容序列化为字符串。
demo.html
<!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></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style type="text/css">* { margin:0; padding:0;}body { font-size:12px;}.comment { margin-top:10px; padding:10px; border:1px solid #ccc;background:#DDD;}.comment h6 { font-weight:700; font-size:14px;}.para { margin-top:5px; text-indent:2em;background:#DDD;}</style> <!-- 引入jQuery --><script src="../scripts/jquery.js" type="text/javascript"></script><script type="text/javascript"> $(function(){ $("#send").click(function(){ $.get("get1.php", $("#form1").serialize() , function (data, textStatus){ $("#resText").html(data); // 把返回的数据添加到页面上 } ); }) })</script></head><body><form id="form1" action="#"><p>评论:</p> <p>姓名: <input type="text" name="username" id="username" /></p> <p>内容: <textarea name="content" id="content" rows="2" cols="20"></textarea></p> <p><input type="button" id="send" value="提交"/></p></form><div class='comment'>已有评论:</div><div id="resText" ></div></body></html>
get1.php
<?phpheader("Content-Type:text/html; charset=utf-8");echo "<div class='comment'><h6>{$_REQUEST['username']}:</h6><p class='para'>{$_REQUEST['content']}</p></div>";?>
阅读全文
0 0
- jq代码学习21----- ajax serialize( )
- jq代码学习----- ajax $.ajax( )
- jq代码学习19----- jq中的ajax全局事件
- jq学习AJAX
- jq代码学习22----- ajax $.getJSON()获取json文件
- jq serialize() 方法
- 表单序列化,jq中的serialize,ajax提交整个form表单,无需逐个拼写json
- jq之serialize()序列化字符串ajax提交到,php端获取
- jq代码学习25——基于jQuery的ajax聊天室 fl ch6 p209
- jq代码学习24-----ajax load()加载、筛选加载HTML问文档 fl ch6 p192
- jq代码学习23-----ajax $.get 和$.post 请求 fl ch6 p192
- ajax提交form表单,关键代码:$("#theForm").serialize()
- AJAX学习笔记之JQ使用方法
- AJAX JQ学习总结(更新中。。。)
- jq ajax
- jQ-ajax
- jq ajax
- JQ AJAX
- git commit报:There are no stage files问题解决
- leetcode450Delete Node in a BST
- Kubernetes 的审计日志和采集
- 二维数组功能测试,超详细
- javascript进阶
- jq代码学习21----- ajax serialize( )
- LeetCode-79-Word Search 爆搜
- BZOJ 2282: [Sdoi2011]消防
- Codevs 2161 奶牛的锻炼
- 字符集详解
- web一些小概念
- 使用javascript(JS)进行MD5加密
- JAVA Freemarker(2)---在IDEA中 SpringMVC整合Freemarker的详细步骤
- css3倒影之 box-reflect