Diálogo jQUery UI: ¿puede funcionar como iFrame?

I have a dialog that has form in it and when the form is submitted it is going to submit location, how can I ensure that my Dialog is working like iFrame so that my browser location will stay like it is, only Dialog will open new form location?

preguntado el 09 de marzo de 12 a las 15:03

@dotoree nah, if it opens different site and someone clicks link in it it will still redirect my browser there -

I think the only way to do this is to put an actual iframe in your dialog. But be aware that the target site can still use window.top to "break out" of your frame and take control of the whole window. -

@Qmal Then I think only with Iframe -

you can ajax submit form and send back html from action url and put that in dialog -

2 Respuestas

poner <iframe id=herpaderp></iframe> in the dialog, and set property target=herpaderp al form.

This will cause the form's POST result to be loaded in the iframe.

If the form is also inside the dialog, you need to add logic to the submit button to hide the form during submitting.


/!\ Note for IE8 - when I tried this, it had trouble printing from inside the iframe.

respondido 09 mar '12, 16:03

You can submit the form using ajax and show the response in your dialog,

Then you can bind the click for a elements in the external page in order to prevent redirection. if you still want to follow the link you can do another ajax request to the link clicked and show the response in your dialog.

//you might need to edit the selector 
$('#mydialog a').click(function(e){
    e.preventDefault();
    //here you need to perform a ajax request to $(this).attr("href")
    //and show the response in #mydialog again
})

espero que esto ayude,

respondido 09 mar '12, 16:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.