jQuery dialog 异步调用ashx,webservice数据的代码
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了jQuery dialog 异步调用ashx,webservice数据的代码,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3183字,纯文字阅读大概需要5分钟。
内容图文
![jQuery dialog 异步调用ashx,webservice数据的代码](/upload/InfoBanner/zyjiaocheng/371/48e96be19df94e0dad01dd0218f42592.jpg)
Html,JS代码:
代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="test_jQuery_dialog_Default" %>
<!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 runat="server">
<title>无标题页</title>
</head>
<body>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script src="js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(
function (){
$('#dialog').dialog({
autoOpen: false,
width: 600,
buttons: {
"Ok": function() {
alert("OK");
$(this).dialog("close");
},
"Cancel": function() {
alert("Cancel");
$(this).dialog("close");
}
}
});
}
)
function show()
{
$('#dialog').dialog('open');
}
function ajax1()
{
$.ajax({
type:"get",
url:"action/test.ashx",
data:{"time":Math.random()},
beforeSend:function(XMLHttpRequest)
{
},
success:function(msg)
{
alert(msg);
}
});
}
function ajax2()
{
$.ajax({
type:"post",
contentType: "application/json",
url:"action/WebService.asmx/HelloWorld",
data:{},
dataType: 'json',
success:function(msg)
{
alert(msg);
}
});
}
function ajax3(setvalue1,setvalue2)
{
if(setvalue1.length==0||setvalue2.length==0)
{
alert('请将两个文本框输入完整!');
return false;
}
$.ajax({
type:"post",
contentType: "application/json",
url:"action/WebService.asmx/HelloA",
data:"{a:'"+setvalue1+"',b:'"+setvalue2+"'}",
dataType: 'json',
success:function(msg)
{
alert(msg);
}
});
}
//返回集合
function ajax4()
{
$.ajax({
type: "post",
contentType: "application/json",
url: "action/WebService.asmx/GetArray",
data: "{'i':'10'}",
success: function(msg) {
alert(msg);
}
});
}
//返回复合类型
function ajax5()
{
$.ajax({
type: "post",
contentType: "application/json",
url: "action/WebService.asmx/GetClass",
data: "{}",
success: function(msg) {
$(msg).each(function() {
alert(msg["ID"]+'___'+msg["Value"]);
});
}
});
}
//返回dataset
function ajax6()
{
$.ajax({
type: "post",
url: "action/WebService.asmx/GetDataSet",
data: "{}",
datatype:"xml",
success: function(msg) {
$(msg).find('Table1').each(function() {
alert($(this).find("ID").text()+'___'+$(this).find("Value").text());
});
}
});
}
</script>
<form id="form1" runat="server">
<input id="dialog_link" type="button" value="Show" onclick="show()" />
<div id="dialog" style="display: none; background-color: Aqua; width: 200px; height: 150px;">
WebService参数1<input type="text" id="txtMsg1" /><br/>
WebService参数2<input type="text" id="txtMsg2" /><br/>
<input type="button" value="调用Ashx一般处理程序" onclick="ajax1()" id="btn1" />
<input type="button" value="调用无参数WebService" onclick="ajax2()" id="btn2" />
<input type="button" value="调用有参数WebService" onclick="ajax3(txtMsg1.value,txtMsg2.value)" id="btn3" />
<input type="button" value="调用返回集合的WebService" onclick="ajax4()" id="btn4" />
<input type="button" value="调用返回复合类型的WebService" onclick="ajax5()" id="btn5" />
<input type="button" value="调用返回DataSet的WebService" onclick="ajax6()" id="btn6" />
<div id="dictionary"></div>
In Dialog!
</div>
</form>
</body>
</html>
作者博客:http://www.cnblogs.com/qixuejia/
内容总结
以上是互联网集市为您收集整理的jQuery dialog 异步调用ashx,webservice数据的代码全部内容,希望文章能够帮你解决jQuery dialog 异步调用ashx,webservice数据的代码所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。