I'm trying to send a data to a PHP page with AJAX, but I can not figure out how to make it work, I'll explain what I have so far!
The dropdown menu has the following code:
<div class="btn-group">
<button class="btn btn-danger btn-lg dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false">
BOTÂO <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" id="status">
<li data="1"><a href="#">valor 1</a></li>
<li data="2"><a href="#">valor 2</a></li>
</ul>
</div>
And AJAX looks like this:
$(document).on('click','#status li',function(){
$.ajax({
url: 'exemple.php',
type: 'POST',
data: {
'valor': $('#data').val()
},
});
});
Is it possible to send the value of a dropdown-menu made in Bootstrap? How can I get the value on the exemple.php page? I think the AJAX part is wrong, but this is not being solved!