Javascrbipt variable to php in same page

Hello. I need a help.

<script type="text/javascript">
					function abc() {
						var id=5;

Now, I want to pass the value of id to a php variable in the same page. How it can be done?

Wil appreciate your help.

javascript is executed client side inside the user’s browser after all the php code was executed previously on the server. PHP code is executed on the server.

You might have to use AJAX to do what you want.

If you can tell us exactly what you are looking to achieve maybe we can help you find a workaround. There could be a different approach.

I would do it using AJAX

I was thinking there certainly a way to get it done