注册Block后无法访问javascript变量 [英] unable to access javascript variable after registering Block
本文介绍了注册Block后无法访问javascript变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
.aspx调用DDLSubOrdinate_change网页方法的文件代码。
.aspx File code to call DDLSubOrdinate_change web method of page.
PageMethods.DDLSubOrdinate_change(vs_HasSubordinatesRoute, nPositionNo, OnSuccess, OnFail);
function OnSuccess(result) {
v = STP_dist[0]
}
Web方法:
Web Method,:
<WebMethod()> _
<System.Web.Script.Services.ScriptMethod()> _
Public Shared Function DDLSubOrdinate_change(ByVal vs_HasSubordinatesRoute As String, ByVal nPositionNo As String) As String
Dim wstr As String
........................
........................
........................
Json_STP = getJson4Table(ds.Tables(0).DefaultView.ToTable, True)
Json_STP = " var STP=[" + Json_STP + "]" + ";"
Json_STP_dist = getJson4Table(ds.Tables(0).DefaultView.ToTable(True, StrColumn), True)
Json_STP_dist = " var STP_dist=[" + Json_STP_dist + "]" + ";"
Json_STP = Json_STP + vbCrLf + Json_STP_dist
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "jstr_STP", Json_STP, True)
Return ""
但是在onMeccess of pageMethod之后我无法访问变量STP_dist
它显示未定义..
请帮帮我...
but after onSuccess of pageMethod i am unable to access variable "STP_dist"
it showing undefined..
please help me...
推荐答案
function OnSuccess(result) {
v = STP_dist[0]
}
您需要从结果中获取返回的数据
函数的参数,而不是来自 STP_dist [0]
,这里似乎未定义。
You need to get returned data from result
argument of function, not from STP_dist[0]
, which seems undefined here.
这篇关于注册Block后无法访问javascript变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文