代码如下:
//后台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);