How do I get the $( data.id ) to become my element? At the moment it evaluates it to an int, not a tag with an specified id. I have tracked it all down to this problem, everything is the correct value according to FireBug until this point.
function editWinner( value, id )
{
new Ajax.Request( 'ajax_edit_winner.php',
{
method: 'get',
parameters: {
value: value,
id: id
},
onSuccess: function( response ) {
var data = response.responseText.evalJSON();
$( data.id ).setAttribute('onclick', 'editWinner( ' + !data.value + ', ' + data.id + ' )');
$( data.id ).update( data.value );
},
onFailure: function(){ alert('Something went wrong...') }
});
}
$is provided by some library, but there are several that use that variable and they do different things with it. What library are you using? (Oh, and don'tsetAttributeon event handlers, use something that abstracts addEventListener (and the Microsoft equiv) and do it properly. (Also make use of the CODE formatting button that the Stack Overflow editor provides)