:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js{API removed}"></script>
<script type="text/javascript">
$(document).ready(function() {
alert('test');
if ($('#profile_visible:checked').val() !== null) {
$.ajax({
url: 'inc/profileVisible.php',
success: function(data) {
$('#resultProfileVisible').innerhtml="success";
alert('Load was performed.');
}
});
}
}
</script>
...と、文書の本文に。 on
(jQueryの> 1.7)またはbind
(jQueryの< 1.7)またはjQueryの各種ショートカット法(等.change
又は.click
)と結合イベントハンドラ:また
$(document).ready(function() {
$("#profile_visible").change(function() {
if (this.checked) {
$.ajax({
url: 'inc/profileVisible.php',
success: function(data) {
$('#resultProfileVisible').html("success");
alert('Load was performed.');
}
});
}
});
});
、場合エレメントのHTMLコンテンツを設定する.html()
代わりに.innerHtml
を使用jQueryオブジェクトを使用します。
例:http://jsfiddle.net/andrewwhitaker/8x6h8/1/
どのリスナーを参照していますか?私はただ一つしか見ることができません - 文書は準備ができています。それはあなたが意味するものですか? –