復制代碼 代碼如下:
//後台cs代碼:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Login_jg : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string get()
{
string name=this.Request["name"]; // 從另一頁獲取參數,可以不需要!
string json = "{Name:'" + name + "',Number:'"15"' + "'}";
return json;
}
}
前台代碼:
復制代碼 代碼如下:
var dpinfo = "<%=get() %>";
var dpjson = eval("(" + dpinfo + ")");
alert(dpjson.Name);