Reputation: 187
I have built a gallery for a client with a popup info page for each thumbnail. I'm trying to reload a jqModal from within the popup, with a new URL.
Here's the JS:
$('#dialog').jqm({overlay:75, ajax: '@ajax-data', trigger: 'a.jqModal'});
And on the main page:
<a class="jqModal" href="#" ajax-data="<?=$server_url?>ajax/ajax_gallery.php?id=<?=$id?>"><img src="<?=$server_url?>photos/<?=$id?>_th.jpg" border="0" /></a>
And when the modal is triggered, it includes a which links to the previous/next image in the gallery. So I want the modal to simply reload with the new URL. According to the docs:
jqm Initialize element(s) as modals. Accepts an options object. If a modal is already initialized, the call will update its options via jQuery.extend().
This is my button code inside the modal ajax_gallery.php:
<input type="submit" name="filterButton" value="PREV" onClick="$('#dialog').jqm({ajax:'<?=$server_url?>ajax/ajax_gallery.php?id=<?=$previd?>'});" />
But nothing is happening. I cant hide the modal, update it and show it again because once it's hidden it's gone and doesnt process further JS, and I dont want to have to kludge it by triggering the main page to refresh and pop up the modal again onLoad.
Has anyone got a jqModal to refresh it's content in this way?
Cheers
Upvotes: 0
Views: 249
Reputation: 832
Lucas,
I would look at using the ajax target option to refresh a modal with new content/images.
Upvotes: 0