jQuery Checkbox Error -


I am working on a jQuery-based TODO list interface, and one wall has hit a bit with JQuery I am working, which I have read, has been hacked together with various tutorials because I am a little bit of an early beginner.

  $ ('# todo input: checkbox'). $ (. $ (This) .is (": check")) {warning ("start"); $ AZ ({type: "GET", url: "/ todos / check /" + id, success: function () {warnings ("This works."}}}})}}}})  < / Pre> 

This is using HTML,

  & lt; Div id = "todo" & gt; & Lt; Input type = "checkbox" check = "yes" value = "1" & gt; Hello world & Lt; Br / & gt; & Lt; / Div & gt;  

Any help on this would be greatly appreciated. For reference, I have an alert in jQuery, for debugging. I can say that the code is not working, because I can not find this alert Thanks.

Just a quick look and I think that is (! $) Try something else (!! $ (this) .attr ('checked'))

Apart from this: The URL in your AJAX statement does not look right. It seems to me a complete path rather than a relative.

One more thing: var id = this.attr ("value") should not be to be var id = $ (this) .attr ("value") ; ?

Let me tell you that these tips help, otherwise a general suggestion:

In your code, you test three things together. First, attach this incident to the correct checkbox Will happen. Then he has to pass a condition, and then he will have to call a successful AJAX call. If only three things work, then we only get feedback, otherwise if there is no place, then we have no way of knowing where the failure was. To make sure this works, test each piece, and then you will know which direction to focus on your efforts: -)


Comments