我已经jQuery的使用AJAX/JSON抓住一个元素ID一个WebMethod可以使用,然后点击:返回多个值jQuery中从
[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窗体中的字段?
这是无效的语法。 – SLaks 2011-03-03 19:12:38
那是什么呢? 'return pageTitle,contentID,nodeID;'? – hunter 2011-03-03 19:13:00
我需要返回的示例。我不知道返回多个字符串的正确方法。 – balexander 2011-03-03 19:13:52