Reputation: 9858
I have a checkbox where when it's clicked, .load() will be called. The requested page loads just fine except that jQuery keeps requesting page over and over again.
<script type="text/javascript">
$(document).ready(function($) {
$('#we').click(function() {
$('#we_div').load('/form_url');
});
});
</script>
<div id="we_div" style="float:right;"><input type="checkbox" id="we" /><label for="we">Some dummy text here.</label></div>
Can anyone tell me what's wrong with this?
Upvotes: 1
Views: 893
Reputation: 177965
@Shef gave the idea. Try this safer method
<script type="text/javascript">
$(document).ready(function($) {
$('#we').click(function() {
$('#we_div').load('/form_url',function() {
$('#chk_span').hide();
});
});
});
</script>
<div style="float:right;"><div id="we_div"></div><span id="chk_span"><input type="checkbox" id="we" /><label for="we">Some dummy text here.</label></span></div>
Upvotes: 1