Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do update a frame through hidden iframe

Status
Not open for further replies.

jeromepelletier

Technical User
Feb 2, 2005
4
CA
How would i use a hidden iframe to search my database for a new message and if there is one it edits the main frame to make it streamlessly update?
 
There are a couple of ways to do this:

1) The hidden frame builds a query string, attaches it to the url for the database query program, and sends that url to the main frame:

[tt]document.frames['main'].location.href = theURL;[/tt]

2) The hidden frame puts data into fields in a form and submits the form, targeting it to the main frame:

[tt]<form name="theForm" target="main">[/tt]
[tt]document.forms['theForm'].submit();[/tt]

3) More complicated, the frame submits the form or url to itself. When the data is returned, it also contains javascript code to transfer that data to the document in the main frame using the document object model to change the page content.

4) Do away with the hidden frame altogether and use XMLHttpRequest (or similar) to request the data and javascript to parse the data and insert it into it's document.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
How much server-side programming and javascript do you know? I gave you the crucial parts of the first two options. I wouldn't really recommend the third option, it's very cumbersome. For the fourth option, google the term AJAX.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Not much, just a little bit here and there. That being why bi dont exactly understand your explaation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top