jQuery Ajax 方法调用 Asp.Net WebService 的详细例子
http://www.cnblogs.com/TerryFeng/archive/2009/02/01/1382123.html
这很常用,搜索了一下博客园的“找找看”和谷歌,看到大部分都是转载于一两篇文章(而且来源还不是博客园),有的是简单的说一点无法运行,给初学者的调试和学习带来不方便,我在这里将jQuery Ajax 调用Aspx.Net WebService 的几个常用的方法做了一个整理,提供给正在找这方面内容的博友,希望能给学习jQuery的朋友一点帮助,可以直接复制代码运行。
ws.aspx 代码
<!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 id="Head1" runat="server">
<title></title>
<script src="jquery.js" type="text/javascript"></script>
<style type="text/css">
.hover
{
cursor: pointer; /*小手*/
background: #ffc; /*背景*/
}
.button
{
width: 150px;
float: left;
text-align: center;
margin: 10px;
padding: 10px;
border: 1px solid #888;
}
#dictionary
{
text-align: center;
font-size: 18px;
clear: both;
border-top: 3px solid #888;
}
#loading
{
border: 1px #000 solid;
background-color: #eee;
padding: 20px;
margin: 100px 0 0 200px;
position: absolute;
display: none;
}
#switcher
{
}
</style>
<script type="text/javascript">
//无参数调用
$(document).ready(function() {
$('#btn1').click(function() {
$.ajax({
type: "POST", //访问WebService使用Post方式请求
contentType: "application/json", //WebService 会返回Json类型
url: "WebService1.asmx/HelloWorld", //调用WebService的地址和方法
相关文档:
using System;
using System.Web;
using System.Text.RegularExpressions;
public static string NoHTML(string Htmlstring)
{
//删除脚本
Htmlstring = Regex.Replace(Htmlstring,@"<script[^>]*?>.*?&l ......
public ActionResult LoadRegionPerformance(TGProject.Models.WModels.TgsOutachiveCondition condition)
{
Account account = (Account)Session["Account"];
var questions = SP.TgsAreaShow(int.Parse(account.AREAID.ToString()));
List< ......
http://www.knowsky.com/5723.html
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
......
Microsoft ASP.NET AJAX可以很方便的让我们在客户端使用脚本调用ASP.NET Web
Services(.asmx),要启用这一特性,像前面提到的一样,必须要配置Web.Config,可以参照Microsoft ASP.NET
AJAX安装目录下的Web.Config,如果是通过ASP.NET AJAX-enabled Web
site模版建立的站点,则不需要再进行设置了。配置节点如下 ......
原文:刘武|asp.net中cookie的处理
使用中发现用Request.Cookies.Remove()无法删除cookie,google了一下发现一般是通过将过期时间设置成过去的时间来完成删除的。顺便整理下cookie的操作:
一 创建
1 单值的创建
C#-Code:
HttpCookie hc = new HttpCookie("Value");
hc.Value = "value";
Response.Appe ......