dotNet

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-10 09:41:40

软件介绍

This plugin is a jQuery 1.2.6 shortcut to the call Web Services or Page Methods under .NET Framework.

With this plugin you can develop AJAX sites under .NET easier than ever, with an EXCEPTIONAL performance!.

I tested this plugin with the JSON.NET framework http://www.codeplex.com/Json. I used this framework, because is very flexible with the JSON output.

Usage:

// I use no conflict because the AJAX ASP.NET Framework Client API
// overrides the $ function.
jQuery.noConflict();
// Execute all when the document is ready.
jQuery(document).ready(function($) {

// private function for debugging
function debug(log) {
if (window.console && window.console.log)
window.console.log(log);
};

/*
* Simpliest call
*/
$.callDotNet("Service.asmx/GetExample", function(result) {
debug(result);
});

/*
* Here we can define a global error handler to the plugin, and data
*/
// WebService URL
var wsUrl = "Service.asmx/GetExampleData";
// Data
var data = "{pageNumber: 1, pageSize: 20, sortColumn: \"FirstName\", sortDirection: \"ASC\"}";
// Global Error Handler for AJAX requests
$.callDotNet.onError = function(error) {
alert("Run away!!!");
}
// The call back method.
function onSuccess(result) {
debug(result);
}
// And fanally the call to the web service
$.callDotNet(wsUrl, data, onSuccess);
});

And a Web Service like:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{

[WebMethod]
public string GetExampleData(int pageNumber, int pageSize, string sortColumn, string sortDirection)
{
List list = new List();
for(int i = 0; i < 30; i++)
{
list.Add(new Example());
}
return JavaScriptConvert.SerializeObject(list, new IsoDateTimeConverter());
}

[WebMethod]
public string GetExample()
{
return JavaScriptConvert.SerializeObject(new Example());
}

[JsonObject(MemberSerialization.OptIn)]
public class Example
{
[JsonProperty]
public string FirstName;
[JsonProperty]
public string LastName;
[JsonProperty]
public string Address;
[JsonProperty]
public DateTime Created = DateTime.Now;

public Example()
{
FirstName = new String('-', 10);
LastName = new String('*', 10);
Address = new String(':', 10);
}
}
}

I hope you like it,

and Happy Coding!

本文地址:https://codercto.com/soft/d/23059.html

UNIX网络编程 卷1:套接字联网API(第3版)

UNIX网络编程 卷1:套接字联网API(第3版)

W.Richard Stevens、Bill Fenner、Andrew M. Rudoff / 杨继张 / 人民邮电出版社 / 2010-6 / 129.00元

这是一部传世之作!顶级网络编程专家Bill Fenner和Andrew M. Rudoff应邀执笔,对W. Richard Stevens的经典作品进行修订。书中吸纳了近几年网络技术的发展,增添了IPv6、SCTP协议和密钥管理套接字等内容,深入讨论了最新的关键标准、实现和技术。 书中的所有示例都是在UNIX系统上测试通过的真实的、可运行的代码,继承了Stevens一直强调的理念:“学习网络......一起来看看 《UNIX网络编程 卷1:套接字联网API(第3版)》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具