我正在使用ajax来调用vb.net中的web服务。我的web服务被成功调用但是在返回后数据控制直接转到ajax调用的OnError.Also web-service被成功调用但是之后控制直接进入失败方法。我的ajax调用是这样的:
$.ajax({
type: "POST",
url: "../Transactions/WBS_Budget_Dynamic.aspx/GetAllData",
dataType: "text",
async: false,
data: JSON.stringify(obj),
contentType: "application/json; charset=utf-8",
error: function (jqXHR, status, err) {
alert("Local error callback.");
},
success: function (data) {
alert(JSON.stringify(data.d));
:
:
我的网络服务撤回了这样的数据:
dttask = objProjectBL.GetBudgetProcessDetails(ProjNo, Parent, Type, Level, DateTime.Now, DateTime.Now, UserNm, HostNm, SelectType, Report_id)
Dim serializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer()
Dim rows As List(Of Dictionary(Of String, Object)) = New List(Of Dictionary(Of String, Object))()
Dim row As Dictionary(Of String, Object)
For Each dr As DataRow In dttask.Rows
row = New Dictionary(Of String, Object)()
For Each col As DataColumn In dttask.Columns
row.Add(col.ColumnName, dr(col))
Next
row.Add("ParentId", Parent)
Dim str As String = dr("Tree_id").ToString()
Dim count As Integer = str.Split(".").Length - 1
Dim LevelCount As Integer = count - 1
row.Add("LevelId", LevelCount.ToString())
rows.Add(row)
Next
Return serializer.Serialize(rows)