My website is storing reviews for other websites. These reviews can be reported by everyone. Currently I'm allowing this to happen through modals. Notice "modalS". I'm creating a modal through a foreach loop (on the reviews) for each review - this means that each review have a modal for report. The thing is it's a little buggy, because sometimes the script can't retrieve properly the ID of the review and It's annoying. You're clicking to report a review and it reports another one. So... Do you guys have any great idea how to implement these reports inside a modal or something similar to modal so I can avoid these ID mistakes? Moving the report script of a review to another page is not an option as it must be dynamically (AJAX based). I'm waiting for your suggestions. Thanks in advance!
I don't see you mention your js framework (if any). I have alot if modals in my apps, but I use react. So I just set the active item, and then open the modal (just one modal shared between all items)
Blade file (where reviews appear - it's the same file where modals are stored) - I show a button that triggers the opening of modal and inside the modal the user continues with the report of a review.
Is there a way on button click to insert in the DOM a modal and pass the ID of the review to the modal somehow? So there (in the modal) will be a form that will send a report for the passed review id. But if the modal is closed it must be removed from the DOM. I need something really simple, but dynamically.
What appear in my head is on button click start an AJAX call (passing the ID) to a blade file with a modal structure which will be inserted in the DOM. Will that work?