我有 jquery 使用 ajax/json 来获取元素 ID,然后点击:
[System.Web.Services.WebMethod]
public static string EditPage(string nodeID)
{
DataTable dt = new DataTable();
using (SqlConnection con = new SqlConnection(Global.conString))
using (SqlCommand cmd = new SqlCommand("contentPageGetDetail", con))
{
cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value = Global.SafeSqlLiteral(nodeID, 1);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
{
da.Fill(dt);
}
}
if (dt.Count > 0)
{
string pageTitle = dt.Rows[0]["Title"].toString();
string contentID = dt.Rows[0]["ContentID"].toString();
return pageTitle, contentID, nodeID;
}
else
{
return "Failed";
}
}
返回时,我想将存储过程返回的所有内容抓取回成功部分的 jquery 方法,并在文本字段中设置隐藏字段、下拉值和标题。
在 jQuery 中,我尝试使用“pageTitle”,但它未定义。在显示表单之前,我需要做什么 jQuery 端来获取返回的内容并填充我的 Web 表单中的字段?