Calling jquery from a javascript function

I am using a third party javascript funtion on a page and want to embellish it using jquery but apparently it doesn’t recognize the jquery method inside the function. Is there a way to make that happen?

i.e. I want to add the $.post method to the function as follows

xyz.event.addListener(pgm, ‘click’, function(event) {
[javascript code]
$.post(“test.php”, {var1: “x”, var2: “y”});
[javascript code]
});

Is it possible to do this?

I got it to work by creating a function with the .post function and then called that and it works, so this can be closed. Thanks