看例子
<%@ 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>
评论