AJAX回发未给出预期结果

编程入门 行业动态 更新时间:2024-10-24 18:25:04
本文介绍了AJAX回发未给出预期结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我在Ajax回发方面遇到问题.它在asp 4中工作正常,但在2.0上却无法运行. 这是我的代码:

Hi all, I am having issues with ajax postback. It worked fine in asp 4 but not on 2.0. This is my code:

$("#<%=registrationNumberTextBox.ClientID%>").blur(function() { if ($(this).val().length > 0) { $.ajax({ type: "POST", url: "registration.aspx/GetAmountDue", data: "{'registrationNumber': '" + $(this).val() + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, success: function(msg) { $("#<%=amountDueLiteral.ClientID%>").val(msg.d); }, error: function(x, e) { alert("The call to the server side failed. " + x.responseText); } }); } else { $("#<%=amountDueLiteral.ClientID%>").html('0.00'); } });

<webmethod()>; _ Public Shared Function GetAmountDue(ByVal registrationNumber As String) As String If registrationNumber.Trim.Length > 0 Then If Student.IsValidRegistration(registrationNumber) Then Dim bi As Student.BasicInformation = Student.GetStudentByRegistrationNumber(registrationNumber) If bi.StudentId <> Nothing Then Dim result As String = String.Format("{0:n2}", bi.StudentAccount.Debit) Return result End If End If End If Return "0.00" End Function

问题是,某些东西返回了结果,但未显示在amountDueLiteral上.我该怎么办?

The problem is that, the something returned a result but not displayed on the amountDueLiteral. What do I do?

推荐答案

(" #< ;%= registrationNumberTextBox.ClientID%>").blur(函数(){ 如果( ("#<%=registrationNumberTextBox.ClientID%>").blur(function() { if (

( this ).val().length > 0 ){ (this).val().length > 0) {

.ajax({ 类型:" POST" , 网址:" registration.aspx/GetAmountDue" , 数据:" {'registrationNumber':'" + .ajax({ type: "POST", url: "registration.aspx/GetAmountDue", data: "{'registrationNumber': '" +

更多推荐

AJAX回发未给出预期结果

本文发布于:2023-11-24 21:50:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626982.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:AJAX   回发未

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!