Create an iFrame to display data
So I have never done this but what I am doing is getting information from an HTML Form, passing the information to PHP to calculate what I need and then puts it in an iFrame on the HTML page. I have 8 outputs and kind of wish the data to output like this pag开发者_如何学编程e does: http://pregapptcalc.appspot.com/.
I tried doing some research online but failed at doing so. Does anyone have any great tips or ideas? Thank you for your time
To simply display a page in an iFrame like this, all you have to do is create the iFrame with JavaScript when you want it. This is very easy with jQuery, or you can use plain JavaScript.
Most people though will choose to use AJAX, and simply populate DIVs with the results. No need to create a whole new iFrame.
Might want to check out using ajax for a display like the link you posted. I don't know of anyway to pass parameters to an iframe but you could point it to some text file and reload the page but I'm thinking you don't want to do that with the example you lookign at. Look into ajax its fairly straightforward.
It is easier to just render the result of an AJAX call (the information that your PHP returns) using JQuery or another Javascript framework, in a div or span.
You want to use iframes when you have another website completly different that the one you're in, or to embed another website (like have a Google window inside your website).
精彩评论