1
I have a code that when you click the button it asks for a reason to click. After writing the reason it switches the button and should exchange the information listed below. This code is in Ajax It’s just not working properly. By clicking this button, he asks for this justification and changes the button, but does not exchange the information. OBS: The same code works with the other button that disables the image I have, but with this button does not work.
The part that’s not working is this:
success: function(r) {
if(r) {
$(t).parent().parent().next().find('.msg_SemEmi').show();
$(t).parent().parent().next().find('.graf_laudo').show();
$(t).parent().parent().next().find('.graf_lau').css('display','none');
$(t).parent().parent().next().find('.img_lau_d').show();
$(t).parent().parent().next().find('.img_lau_a').css('display','none');
$(t).removeClass('semEmi btn-default');
$(t).addClass('comEmi btn-warning');
$(t).empty();
$(t).append('<span class="btn-label"><i class="fa fa-check-square-o"></i></span><?= $this->lang->line("con_inflaud_afe_comEmi"); ?>');
} else {
notifica('<?= $this->lang->line("con_inflaud_msg_erro_title"); ?>', '<?= $this->lang->line("con_inflaud_msg_erro_d"); ?>', 4000);
}
}
Here is the HTML that calls this Ajax:
<div class="btn_semEmi">
<input type="hidden" id="input_semEmi<?= $l->img_id ?>" name="id_foto" value="<?= $l->img_id ?>">
<a href="javascript:void(0);" id="semEmi<?= $l->img_id ?>" id-foto="<?= $l->img_id ?>" class="btn btn-labeled btn-default pull-right semEmi"> <span class="btn-label"><i class="fa fa-ban"></i></span><?= $this->lang->line("con_inflaud_afe_semEmi"); ?></a>
</div>
My code is in MVC
Any error message in the browser console?
– Zanotta
If you understand English, please read that answer.
– DontVoteMeDown
Put all the code related to AJAX as for example this variable
t
, what does it represent? What exactly should the code do that it’s not doing? Have you been able to identify which part of the code the problem is in? What do you mean "but does not exchange information", are talking about these codes.parent().parent()...
? If it is put the HTML that represents this structure.– KaduAmaral
@Kaduamaral thank you for your concern, but I managed to arrange just by calling the id what needed. Thank you!
– Ketlin
Not at all @Ketlin, could you please post your solution as an answer here? Just click the blue button just below: Answer your question.
– KaduAmaral