2
I need to include on the data-formid="" the id of each event clicked, so that it is different and give u Ubmit with ajax in each form.
I’ve managed to pass the id that way:
Html
<div id="eventID_faturar"></div>
Jquery
This line is where I get the id - $('#eventID_invoice'). text(Event.id);
eventClick: function(event, jsEvent, view) {
endtime = $.fullCalendar.moment(event.end).format('h:mm');
starttime = $.fullCalendar.moment(event.start).format('dddd, D MMMM YYYY, h:mm');
var mywhen = starttime + ' - ' + endtime;
var mywhen2 = event.id;
$('#modalTitle_excluir').html(event.title);
$('#modalWhen_excluir').text(mywhen);
$('#eventID_faturar').text(event.id);
$('#calendarModal_excluir').modal();
}
Upshot
<div id="eventID_faturar">969</div>
But I would need to include this id in the data-formid="", how would I do that
<form class="faturar_ajax" data-formid="id_aqui" method="post" enctype="multipart/form-data">
<input type="hidden" id="eventID_faturar" name="eventID_faturar"/>
</form>
And in the form I do how to put the id in data-formid=""?
– Wagner
If your jQuery has version above or equal to 1.6.4, the
jQuery.data(<parametro>)
puts and reads from the HTML attributedata-<parametro>
– Marcelo Shiniti Uchimura
What do you mean? I didn’t understand, I put my form so but I didn’t see the id in data-formid="" <form class="faturar_ajax" data-formid="" id="eventID_invoice" method="post" enctype="Multipart/form-data">
– Wagner
I am using jQuery v3.3.1
– Wagner
I edited the answer. Please check if it meets your need and if it meets, accept my answer and score.
– Marcelo Shiniti Uchimura
yes I understood, but as I said before, it still didn’t work, my form is like this <form class="invoice"invoice" data-formid="" id="eventID_invoice" method="post" enctype="Multipart/form-data"> and my jquery so $('#eventID_invoice'). data('formid', Event.id);
– Wagner
Dude, look at EDIT, doing me a favor.
– Marcelo Shiniti Uchimura
Yes I left my jquery like $('form:eq(0)'). data('formid', Event.id); but the id has not yet come=""
– Wagner
Do
$('form:eq(0)').data('formid', 12345);
and see if anything pops up. If it does, the problem is inevent.id
.– Marcelo Shiniti Uchimura
I did as you falour and did not appear the id yet Event.id is working because as I said in the question, so it works $('#eventID_invoice'). text(Event.id); but it’s inside a div and I want the id to be in data-formid=""
– Wagner
Let’s go continue this discussion in chat.
– Marcelo Shiniti Uchimura