I have this follow code in my javascript.
I call this function when the user click in a specific checkbox and then I just change the image of this checkbox.
the problem is that my ExportaZap are accessed just one time, for example, if a click now in my checkbox, I call ExportaZap.ashx and then change the image of this checkbox. If a click again, he don't pass through my ExportaZap.ashx.
How can I do to call ExportaZap ever than my user click on my checkbox using the function below ?
function Visibilidade(id, imagemBaixa, credenciada) {
$.get("../Action/ExportaZap.ashx", { id: id, imagemBaixa: imagemBaixa, credenciada: credenciada }, function (data) {
if (data != "limite") {
if ($("#" + imagemBaixa).attr("src") == "../tema/default/images/CheckVerde.png") {
$("#" + imagemBaixa).attr("src", "../tema/default/images/CheckCinza.jpg");
}
else if ($("#" + imagemBaixa).attr("src") == "../tema/default/images/CheckCinza.jpg") {
$("#" + imagemBaixa).attr("src", "../tema/default/images/CheckVerde.png");
});
}
Something like this should do the trick:
$(document).ready(function(){
$('input[type=checkbox]').click(function(){
Visibilidade(this.id, imagemBaixa, credenciada);
});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.