次の単純な html ページは、[クリック] または [すべての段落を非表示] ボタンをクリックしたときに応答しません。 Firefox の「ソース ページの表示」をクリックしてクリックします。私のブラウザでのこのファイルの URL はmylocalhost:8080/ajaxAppJquery/tryAjax.jspです。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Simple Ajax Example</title>
<script src="jquery-1.9.1.min.js"></script>
<script>
$("#button").click(function(){
alert("working");
var url="http://localhost:8080/ajaxAppJquery/sayHello.jsp";
$("#result").load(url);
});
$("#hide").click(function(){
$("p").hide();
})
</script>
</head>
<body>
<input id="button" value="click" type="button"/>
<input id="hide" value="hide all paragraphs" type="button"/>
<p>paragraph 1</p>
<p>paragraph 2</p>
<p>paragraph 3</p>
<p>paragraph 4</p>
<p>paragraph 5</p>
<p>paragraph 6</p>
<div id="result"></div>
</body>
</html>
#button をクリックしてもメッセージは警告されません。実際には jquery-ajax を試していますが、#hide ボタンでも機能しません。