so here's my problem:
I have these two rows with an image and the button to confirm
what i want is that when i click in that button, the other button don't behave like the one that is being clicked.
(i also don't want that the loading on both of them happen)
how it ends
what i want
View:
<a id="executarJob1" href="#">
<img class="jobexecutadoimg1" src="{{ URL::to('/icons/donetarefa.png') }}">
<img class="jobexecutadogif1" width="25" height="18" src="{{ URL::to('/icons/loading.gif') }}">
</a>
<img class="jobexecutadoimg2" src="{{ URL::to('/icons/donetarefacomplete.png') }}">
<a id="executarJob2" href="#">
<img class="jobexecutadoimg1" src="{{ URL::to('/icons/donetarefa.png') }}">
<img class="jobexecutadogif1" width="25" height="18" src="{{ URL::to('/icons/loading.gif') }}">
</a>
<img class="jobexecutadoimg2" src="{{ URL::to('/icons/donetarefacomplete.png') }}">
My code with ajax:
$(document).ready(function () {
$(".jobexecutadoimg2").hide();
$(".jobexecutadogif1").hide();
$("#executarJob1").on('click', function () {
$.ajax('{{route("executar",$lnd->id_demanda)}}',
{
beforeSend: function (carregando) {
$('.jobexecutadoimg1').html(carregando).hide();
$('.jobexecutadogif1').html(carregando).show();
},
success: function (finalizado) {
$('.jobexecutadoimg2').html(finalizado).slideDown('slow').show()
$('.jobexecutadoimg1').html(finalizado).hide();
$('.jobexecutadogif1').html(finalizado).hide();
}
});
});
});
Image names to let you guys know which one is being handled
- jobexecutadoimg1 = Blue button
- jobexecutadoimg2 = Green button (done)
- jobexecutadogif1 = Gif button (loading)
How can i use $this inside my ajax? Thanks.