找传奇、传世资源到传世资源站!

wcf restful简单实现代码(入门级)

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

看例子
from clipboard<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="LONGFrame1.WebForm1" %><!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> <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script></head><body> <form id="form1" runat="server"> <div> <input type="button" value="Test" id="btnTest" /> </div> </form> <script type="text/javascript"> $("#btnTest").click(function () { //$.get("http://localhost/wfcrestful/user/get/1", function (json) { alert(json) }); /* $.ajax({ "url": "http://localhost/wfcrestful/user/add", "type": "POST", "contentType": "application/json", "dataType": "json", "data": '{\"Id\":1,\"Name\":\"我是内容哦哈哈\"}', "success": function (returnValue) { alert(returnValue); } });*/ $.get("http://localhost/wfcrestful/user/GetList/22", function (json) { alert(json[0].Name); }) return; $.ajax({ "url": "http://localhost/wfcrestful/user/addlist", "type": "POST", "contentType": "application/json", "dataType": "json", "data": '[{\"Id\":1,\"Name\":\"我是内容哦哈哈\"},{\"Id\":2,\"Name\":\"我是eric\"}]', "success": function (returnValue) { alert(returnValue); } }); }); </script></body></html>

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复