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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reload different frame while not reloading current frame

Status
Not open for further replies.

livestrong

Technical User
Nov 27, 2006
29
IE
Hi Everyone,

I have an online store.

It has two frames that we are concerned with here

mainframe = contains table of results and quick add button

topframe = contains basket info

At the moment when a user hits the add button the mainframe reloads and i have a piece of javascript that reloads the topframe as follows

Code:
<body onLoad="parent.topframe.location.reload();">

also at the moment this is the start of my form for the add button.
Code:
<form name="myform" action = "<?echo $_SERVER['PHP_SELF'];?>?id&quantity&myanchor">

What i would like to do is send these parameters to the topframe and reload just the topframe and not the mainframe.

Anyone got any ideas that would be great.
 
What is the event for your add button? Is it a submit?

Currently you are reloading the topframe with the onLoad event in the body tag. You could call the same command from code for your Add button so that the whole page does not have to reload in order to trigger the onLoad event.
If your Add button is working as a submission of the form though and sending the form data to a server-side script you would not be able to submit that data without reloading the page or moving to a new page. The alternative would be to use AJAX to send data to a processing page and return the results, then send a command to update the topframe.

If you are not submitting the mainframe form data and instead are using Javascript to store the data in a cookie then you could then just issue the call to reload the topframe.

The big problem though is that you are trying to put critical functionality into client-side code. You open up a strong possibility for the site not to work for some people or possible holes in the site's security. You would be better off having the scripts running server-side and dealing with the page refreshing issues, possibly even discarding the use of frames.


At my age I still learn something new every day, but I forget two others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top