0% found this document useful (0 votes)
23 views

Java

The document handles click events for buttons, makes AJAX POST requests on click to change a state, and adds/removes CSS classes like 'on' and 'off' depending on the response.

Uploaded by

Alfa Solution24
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Java

The document handles click events for buttons, makes AJAX POST requests on click to change a state, and adds/removes CSS classes like 'on' and 'off' depending on the response.

Uploaded by

Alfa Solution24
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

.

css("background-color", "#FF00FF");

$( ".btn" ).click(function() {
var idBtn = $( this ).attr( "name" );
$.ajax({
type:"POST",
url:"estado.php",
data:"idBtn=" + $( this ).attr( "name" ),
success:function(r){
if (r == 0) {
alert("llegue a 0");
$(this).addClass("off");
$(this).removeClass("on");
};
if (r == 1) {
alert("llegue a 1");
$(this).addClass("on");
$(this).removeClass("off");
};

//$('#select2lista').html(r);
}

You might also like