0% found this document useful (0 votes)
27 views1 page

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
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

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
We take content rights seriously. If you suspect this is your content, claim it here.
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