$('#myClick2').click(function() {
var value = $(this).val();
If (value != 'on') {
$.getJSON('message_center_getMessageLists.asp', {}, function (json) {
alert(json.one);
alert(json.two);
alert(json.three);
})
.error(function() { alert("There was an error while trying to make this request; If it persists please contact support"); });
}
});
$ .getJSON部分はIF文を囲むまでうまくいきました。現在チェックされていない場合にのみ、.getJSONを実行するチェックボックスを取得しようとしています。私が間違ってやっていることは誰でも知っていますか?Jquery構造が期待どおりに機能しない場合
チェックボックスをthis' 'です
if ($(this).is(':checked'))
をしたいですか? – SLaks–
'.click'の代わりに' .change'を使いたいかもしれません。 –