jQuery modal stack with ajax forms
<p>I have a simple function that opens a url inside a modal and there can be multiple modals on the page. In one such example the user would open up a modal from another modal say to edit some content that is currently being show in the first modal.</p>

<p>The problem is when the form inside the second modal is submitted (using ajax) is how to refresh the first modal. I would need to know two things which modal to refresh and what content to use to refresh the modal with.</p>

<p>Has anyone ever done anything like this before? Has some ideas?</p>

<p>The only idea I could come up with was to record the indexes and urls each time a user clicks an ajax modal link and store them in an array and then when the form submits check if the parent modal of the form index matches one of the arrays and then use the values to refresh the correct modal with the url that is also stored inside the array. But this is very long-winded and quite sloppy and the results are unpredictable.</p>

<p>Anyone got any other/better solutions?</p>

<p>Cheers</p>
