Get(通过远程 HTTP GET 请求载入信息。)
来源:互联网 发布:网络装修公司哪家最好 编辑:程序博客网 时间:2024/06/16 01:24
代码一:
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <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> <script src="JS/jquery-1.3.2.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $("#send").click(function() { // $.get("Test1.aspx", $("#form1").serialize(), function(data) { // $("#resTest").html(data); // }); $.get("Test1.aspx", { username: $("#txt1").val(), content: $("#txt2").val() }, function(data) { $("#resTest").html(data); }); }); }) </script></head><body> <form id="form1"> <p> 评论:</p> <p> 姓名:<input type="text" name="username" id="txt1" /></p> <p> 内容:<textarea name="content" id="txt2" rows="2" cols="20"></textarea></p> <p> <input type="button" id="send" value="提交" /></p> </form> <div class="comment"> 已有评论:</div> <div id="resTest"> </div></body></html>
Test1页面:
protected void Page_Load(object sender, EventArgs e)
{
string name = Request["username"];
string content = Request["content"];
Response.Write("<div class='comment'><h6> " + name + ":</h6><p class='para'>" + content + "</p></div>");
Response.End();
}
代码二:
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <script src="JS/jquery-1.3.2.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $("#txt1").change(function() { var num = $("#txt1").val(); $.get("Default.aspx", function(result) { var tickets = parseFloat(result); if (num > tickets) { $("#Error").html("每人" + tickets); } else { $("#Error").html("OK"); } }); }); }); </script></head><body> <form id="form1" runat="server"> <div> <input type="text" id="txt1" /> <div id="Error" style="color: Red;"> </div> </div> </form></body></html>
Default.aspx页面:
protected void Page_Load(object sender, EventArgs e)
{
int tickets = 5;
Response.Write(tickets.ToString());
Response.End();
}
- Get(通过远程 HTTP GET 请求载入信息。)
- GetJson (通过 HTTP GET 请求载入 JSON 数据)
- 通过http-Get请求调用Web Service (C#)
- 通过Socket实现Http中Get请求
- http请求远程接口获得JSON数据(1) --- 利用HttpURLConnection发送post/get请求
- http请求远程接口获得Json数据(2) --- 利用HttpClient发送post/get请求
- http post get 请求
- Unity3d Http Get请求
- HTTP GET/POST 请求
- http post get请求
- HTTP Get请求
- http请求 get post
- http get请求
- http post get请求
- http get请求
- http get 请求
- HTTP请求GET,POST
- Http请求 post get
- 关于android2.3调试g-sensor
- Linux 解决NVIDIA黑屏经历
- LCD 调试心得
- sql server 数据库还原
- NEHE的OpenGL-Lesson 02 Your First Polygon
- Get(通过远程 HTTP GET 请求载入信息。)
- VC 枚举硬盘 获取硬盘剩余空间
- 工作心得2
- NEHE的OpenGL-Lesson 03 Colors
- 一条进程的栈区、堆区、数据区和代码区在内存中的映射
- jQuery.data()方法
- 让SecureCRT vi中显示多色彩
- Data Types
- Linux串口(serial、uart)驱动程序设计