Hi. I’m trying to make a gallery. In this gallery the user choose something (eg. a link, an input image) to open a certain gallery. Something like gallery of galleries. I use forms instead href. Thus a variable is sent via form submit to open some directory with php glob on another page.
I need to display images through iframes inside jquery colorbox plugin.
I’ve tried with this but I didn’t get anything.
Hi @master_39, one problem is that the JS gets executed before the DOM is ready, so your jQuery objects are all empty. To fix this, just put your JS right at the end before the </body> tag.
Another issue is that you’re attempting to serialize the submit button, not the actual form. Try something like
BTW, if you’re only using the form to hold values that are fixed and sent with AJAX anyway, you can do this with a link just as well by storing the values as data attributes, like e.g.
Thank @m3g4p0p for your help. I have fixed my code.
Although I got a modal window I can’t display the page2.php content in this, as if the directory folder were empty.
I would really like to use dynamic value more than fixed values. In this way the information is updated by itself. Something like this:
BTW an input element doesn’t have a src attribute… could that be the error?
As for the missing content, a first step would be to check what response is actually received (if any). You might log the data in the success method, or even better check the network panel in the dev tools of your browser. If you have it opened while sending the request, the response will appear there, including headers and the entire body. And with the status could you could rule out internal server errors (500) or not found (404).
You’re right. In any case I used forms instead of href as it gives me more security when I send data through the url.
For the missing content I have checked the network panel but I did not find any errors in this. In fact I can see the .jpg files in the network panel but not in the modal window.