Passing A Php Variable To A Modal
Hi I have a calendar and when I click on the date it opens a modal window where you can add an event to the calendar however to do so I need the date that was clicked on to be pass
Solution 1:
I'm not sure if I understand well your problem but you probably have to use javascript. Actually It can't work
You should have one modal, and when the client choose a date, put this date in the modal in Javascript or jQuery.
Example in jQuery (not tested but this is the logic):
$("td.yourtdclass a" ).on("click", function() {
var choosen_date = $(this).attr('data-date');
$('.modal-body').html(choosen_date);
});
Since we have not much informations about your code I can't help more but here is the logic you need ;)
EDIT:
For your example:
html input:
<inputid="event-data"type="hidden" name="date" value="" />
jQuery:
$( "td.yourtdclass a" ).on("click", function() {
var choosen_date = $(this).attr('data-event');
$('#event-data').val(choosen_date);
});
Post a Comment for "Passing A Php Variable To A Modal"