1
Hello, I have a question and I would like to ask for your help. Well, I’ll try to explain more or less the problem (the names I’ll quote are just for example).
Imagine I have a file called "main.php", then inside this file has two Iframes:
Now let’s imagine that I have the first iframe open in modal format (or fancybox), and I want through this first iframe, I can reload the other iframe that is also referenced in the file "main.php".
I had tried that way, but unfortunately it didn’t work:
window.parent.$('#iframe-sistema').location.reload(true);
Just to be clear. "iframe1.php" would be a data listing iframe that comes from the database, that when clicking delete, it will open "iframe2.php" in modal format (or fancybox,popup,etc) that will ask if I really want to delete that record.
After confirming the deletion, this same iframe (the "iframe2.php") will display a message if everything went right and after pressing the "ok" button, it will auto close and reload the "iframe1.php" to show the records that remained after deleting a record.
I know that to some this may seem like excessive use of iframe, but the point is that this is a system that’s going to be very modular, where the use of code has to be reusable so that there is no repetition of code and consequently end up generating a heavy and difficult maintenance system. If anyone also knows an alternative solution for using iframes, I appreciate it. = D Note: (I use Jquery’s load() function in some parts of this system, but I don’t know if it can work in this situation).
Are the two iframes in the same domain? why don’t you do it without iframe?
– Sergio
Yes. Even the references of the two iframes are in the same file. I don’t really like to use iframes, but in this case I haven’t found an alternative use of iframes.
– Lucas Cavalcanti
If you describe what you want to do we understand the problem better and you might learn a better way to do it...
– Sergio
OK. I will try to improve the description of the problem.
– Lucas Cavalcanti
Lucas: forget the idea of iframe! Do it with the
.load()
. A div that displays what you want with dynamic content and the dialog to interact (ask for confirmations) from the user. If you put more code on the page I can give a hint during fds. If no one helps before.– Sergio
Thanks for the help, I’ll try the way you said. Anything I come back here to talk the result.
– Lucas Cavalcanti
@Lucascavalcanti, since you yourself solved your problem, could perhaps remove the solution from the question and create an answer to your own question by explaining your solution. It would be easier to identify the solution to your problem (I read the whole question to later find that it was solved, =D), and it is still possible to receive votes in your answer.
– Fernando Leal
Thank you. I’ll do that ;)
– Lucas Cavalcanti