I am trying to send the data from a PHP page with AJAX , but I am not able to understand how this works, I will explain what I have done so far.
Bootstrap dropdown:
<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>
AJAX:
$(document).on('click','#status li',function(){
$.ajax({
url : 'exemple.php',
type : 'POST',
data : {
'valor' : $('#data').val()
},
});
});
I changed the AJAX to:
$(document).on('click','#status li',function(){
$.ajax({
url : 'exemple.php',
type : 'POST',
data : {
'valor': $(this).attr('data')
},
});
});
But does not work aswell. Any idea please?