jqueryを介してWebサービスとajaxを操作する方法を学習しようとしていますが、解決方法がわからない問題があります
私はhtmlページに含まれています:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#btn').click(function () {
$('div').load('AjaxServices.asmx/HelloWorld');
});
});
</script>
</head>
<body>
<h1>ws</h1>
<button type="button" id="btn">get info</button>
<p>the site says...</p>
<div id="one"></div>
<div id="two"></div>
<div id="three"></div>
</body>
asmx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
using System.Web.Script.Serialization;
namespace ajaxTutorial
{
[[WebService(Namespace = "http://appdev.com/jQueryAjax")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class AjaxServices : WebService
{
private static int count = 0;
[WebMethod]
public string HelloWorld()
{
count++;
return "Hello World" +count.ToString();
}
}
}
- asmx.csファイルを実行すると、ロードされます。メソッドを呼び出すと、問題ないようです。
-これは私がクロームで得るエラーです:
-これはソリューションエクスプローラーです:
これは開かれているポートです:
*私は本当に何が起こったのかわかりません、誰かがこれを通して私を導くことができますか?
それを解決するためにここでどのような選択肢がありますか?
よろしくお願いします。(はい、私はその古い技術を知っています、私は後でwcfを使用することを学びます)