dポイントプレゼントキャンペーン実施中!

ASP.net Ajaxが動作しませんなぜ動作しないのでしょうか
WebConfigはデフォルトです。
参考サイト:
https://qiita.com/icoxfog417/items/b7910008484b1 …

環境:visualstudio2017

■vbソース
Imports System.Web.Services
Public Class _Default
Inherits Page
<WebMethod()>
Public Shared Function A(ByVal text As String) As String
Dim page As New _Default
page.test.Text = text
Return "OK"
End Function
End Class

■デザイナソース
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7. … type="text/javascript"></script>
<script>
function a() {
$.ajax({
type: "POST",
url: "_Default.aspx/A",
data: JSON.stringify({ text: "echostring" }),
contentType: "application/json; charset=utf-8",
dataType: "json",
cache:false
}).done(function (data) {
//data.dに返り値が入っている
window.document.getElementById("test").innerHtml = data.d
})
}
</script>
<form runat="server">
<asp:DropDownList ID="DropDownList1" runat="server" OnChange="a()" >
</asp:DropDownList>
<asp:TextBox ID="test" runat="server"></asp:TextBox>
</form>

A 回答 (1件)

ASP.netのバージョンは?(2.0?)


Ajaxは1.0?
掲載の際とは3年前の古いもの。
    • good
    • 1

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!