Send post data to an iframe opened with shadowbox

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Send post data to an iframe opened with shadowbox

Starvation
Hi there.

ok, open a link in an Iframe with shadowbox (by clicking on a link) is extremely easy...

but is possible to open that link (of course with shadowbox) while sending it some post data?

I'm stucked on this...
any help would be appreciated
Reply | Threaded
Open this post in threaded view
|

Re: Send post data to an iframe opened with shadowbox

manfer
I really I'm not sure what you are trying to do but maybe you have to consider if you are designing a correct flow. I'm going to try to put some concepts and maybe that makes you think of some way to do it.

<ul>
<li>Think on terms of MVC (model/viewer/controller).</li>
<li>Shadowbox is only a view layer library.</li>
<li>A post request will be part of the controller, not the view. You send post data (the model) to the server not to an iframe.</li>
<li>You process the request on server and you send the response to the browser.</li>
</ul>

If you need the response to be opened in a shadowbox you can always do it with the shadowbox API function Shadowbox.open. Maybe with an onload event. (in a $(document).ready, for example).

Or even better I think, just do an ajax post and you will be able to use the response as you wish, including opening it in shadowbox. With jQuery or other do more write less library would not be too much code.

http://api.jquery.com/jQuery.post/

Learn how to do the post and then opening the response in shadowbox with shadowbox.open and using html player instead of iframe player, should be easy.