> \$("#query").load("/mysite/thepage.pl", {thequery}, > function(){
In this case the error is right. {thequery} is not a valid initializer for an object. Maybe you meant {data: thequery} or something like that? What is the name of the parameter that your Perl page expects to get from the URL querystring?