I am getting the following error message in my FF console:
"uncaught exception: Syntax error, unrecognized expression: ""
jQuery.noConflict();
jQuery(function() {
jQuery('#foobar').click(function(){
var id = jQuery(this).parent().parent().attr('id');
var idstr = '"#'+id+'"';
jQuery.post("example.com/callback.php", {id: id },
function(data){
jQuery(idstr).html(data.msg); // <- error occurs here
}, "json");
});
});
As can be seen, I want to update the contents of a div with the received data.
These are the tests I have done so far:
inserted alert() statements to make sure
- that data is being correctly returned from server (PASS)
- that the element represent by idstr exists (PASS)
commented out the line where the div contents are being replaced, to see if error message goes away (PASS)
I can't see anything wrong with the code above (but then I am relatively new to jQuery). Can anyone spot what is causing the error?.
Also, I would like to briefly visually highlight the div that has had its contents updated (a bit like what happens here on SO, when an answer is accepted) - I am thinking of changing the element class and setting timers etc, but there may be a simpler way of doing that - can anyone help with how to do the 'highlighting part'?