Good day, hello to all.
This is the day I ’m messing with fancybox and I can’t figure out how to transfer values from a modal window to the page where the form was called from. The essence of the problem is that there is a page on which the city is selected. When you click on a city , a modal window pops up, where you need to select a city from the list by ticking (the option can be multiple), and then there is a button to choose . When you click on a button, select - the modal window should disappear and on the page instead of the label select a city - is replaced with the city selected from the list.
On the /index.php page, the modal window is called, html:
<div class="bl_categoty"> <div class="choice_category">Выбрать город</div> <div> here is js:
$(".choice_category").fancybox({ 'padding':6, 'href':'/modal/categories.php', // события при закрытии формы применяется. beforeClose: function(){ console.log("форма закрыта"); $(".bl_categoty .value_heading").empty().text("ГОРОД"); } }); The modal window is in / modal/categories.php. On this page there is a list of cities and a button to select . When you click on it, it is necessary that the data is transferred to the /index.php page and substituted into .choice_category. The js code for the /modal/categories.php page is below:
$(".action_category").click(function(event){ // value_heading должно записаться выбранный город. - не применяется $(".bl_categoty .value_heading").empty().text("ГОРОД"); parent.jQuery.fancybox.close(); // событие срабатывает // не применяется $('.choice_category').fancybox({ beforeClose: function(){ console.log("*******************"); $(".bl_categoty .value_heading").empty().text("ГОРОД"); } }); }); How can I transfer parameters from the modal window to the /index.php page
Thanks in advance for your reply. I would be very grateful for any help.