Is there a way to pass a JSON object directly into PHP and work with it?
Something like this:
<script>
var gridData = {"id":100,"level":"B","Zone":"Entry"};
</script>
<?php
echo "Your grid Information is:". [**How to get the gridData displayed here**]
?>
I know I can pass to backend using AJAX, get the result and show it up in a div, but is there an easier way since I am already in this page and I already have the data in Javascript?
Also please note: I am working off some really old legacy code I inherited with lot of business logic calculations in a custom javascript platform, so please bear with me that the whole architecture is a bit odd 🙂
No, you cannot do that.
Javascript is executed on the client after php has completely finished its execution on the server.