I want to send a data from javascript to php. This data is the id of the html div that selected by user. It means that first user click a div and then the id of that div send to javascript file and now I want to send it back to my php file. I dont want use HTML form. how can I do it?
Here is my HTML code:
<div onclick="myFunctionElt(this);" class="player_interface" id="'.$id[$i].'">
</div>
This is my javascript file:
function myFunctionElt (elt) {
$.post('phpurl.php', { id: elt.id} );
}
And now I want to do this:
$value = $_POST['id'];