How to pass value from PHP produced HTML to Jquery without form element?

How to pass value from PHP produced HTML to Jquery without form element?

I am facing the problem that I don't know how I can pass a value from an PHP-generated <a> or <div> tag to Jquery. With Jquery I would like to load again the same PHP script but with a different start value $x. Can anybody help? Thank you!

  1. var loadWeb = "./foo.php" + <?=$x;?>;
The code above in my Jquery file does not work. Do I need to generate the JS with the PHP?