V
V
Vladimir Boldt2018-03-20 15:49:19
JavaScript
Vladimir Boldt, 2018-03-20 15:49:19

Is it possible to send POST data from a hidden input to an SVG image?

Faced the following problem. There is a map in SVG format, which is a filter for articles. After selecting from one or more regions on the map, for example, the "Filter" button is pressed. Now everything works for me as follows: javascript checks which areas of the SVG have been selected and assigns true or false to the hidden checkboxes, when the button is pressed, everything selected is transferred by the POST method to the controller. If there are few regions on the map, then there is no problem, it is not difficult to link the id of the parts of the map and the id of the hidden checkboxes, but what if the map contains dozens of them? If you enter inputs directly inside the SVG regions of the map and use $this in Javascript, then the checkboxes are checked, but the data of the checkboxes located inside the SVG is not transmitted by the POST method. Can anyone suggest the logic of the script? How to pass selected data to PHP,

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2018-03-20
@webinar

And what's the difference how many of them, the code is no more. And why hidden inputs? Just data-attribute, json object in which we collect data, by clicking somewhere we send json, ajax post. we receive json data in response, we build a house. Or we get a finished piece of html. If you need to change the url, you can fasten https://github.com/defunkt/jquery-pjax

A
Alexander Simonov, 2018-03-20
@SimasikS

I would take the selected ones into an array and send them to POST.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question