<!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> <title>无标题页</title> <mce:script src="jquery-1[1].3.1.min.js" mce_src="jquery-1[1].3.1.min.js" type="text/javascript"></mce:script> <mce:script type="text/javascript"><!-- $(document).ready(function(){ $("#oo").click(oo); }); function oo() { $.getJSON("Default.aspx",{ name: $("#Text1").val(), time: "2pm" }, ff); } function ff(json) { alert(json.city+json.time); } // --></mce:script> </head> <body> <p> <input id="Text1" type="text" /><img id="oo" alt="" src="Adobe%20Illustrator%20CS3.png" mce_src="Adobe%20Illustrator%20CS3.png" style="height: 20px; width: 45px"/></p> </body> </html> 服务 using System; using System.Configuration; using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using Newtonsoft.Json;//引入Newtonsoft.Json.dll public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Hashtable d = new Hashtable(); d.Add("city", Request.Params["name"]); d.Add("time", Request.Params["time"]); Response.ContentEncoding = System.Text.Encoding.UTF8; Response.ContentType = "application/json"; Response.Clear(); Response.Write(JavaScriptConvert.SerializeObject(d)); Response.End(); } }