PHP is a server language, which means it's called before a page renders, and the browser is given control over content. So, PHP itself cannot possibly "know" that there is javascript on the page, and that it is trying to do something that warrants communication.

In turn, javascript is a browser (or, client side) langauge, and is given control after the page has been rendered (technically... in reality, it is given control as the DOM loads, or as a line of javascript is read by the browser).

There is still the question though, what are you ultimately trying to accomplish here? Getting the ID from an element in jQuery is super simple, but what are you doing with this ID exactly? What is the end result you are hoping for?

Here a couple of links with some good examples for using jQuery to make the AJAX calls. The Nettuts link has some good information about passing params to the external file.

Move both to your server. Open example.html. You now have a working AJAX call.

You will see that the JAVASCRIPT and the PHP are totally separate, and the JAVASCRIPT sends information to the PHP which simply waits for data to act upon.

So lets talk about what you want to do. You wanted to send the ID of the item clicked to the PHP.

We set the AJAXObj.open("GET", "myAJAX.php?string=" + myString, true).... the way we got myString was by grabbing the id of the item (so, we know it), and we can just send it.. we can also use a number of methods to figure out the ID based on the click event in javascript, or any other number of things....