Solved

Refreshing part of a page

Posted on 2004-08-23
4
175 Views
Last Modified: 2010-04-01
I have a requirement for which i have to go to the server , fetch some data and refresh only a part of the page. The rest of the page should remain as it is. I am thinking of using Frames. Any other way to do it ??

Thanks,
Mrigank.
0
Comment
Question by:mrigank
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 11868402
> Any other way to do it ??

Not that I can think of...  Why can't you refresh the whole page?
0
 
LVL 5

Author Comment

by:mrigank
ID: 11868617
Actually if i refresh the whole page, i will have to save the state of the page... which i would not want to do .. as i do not want to make db calls....  Not sure if struts will do the same for me
0
 
LVL 35

Accepted Solution

by:
TimYates earned 40 total points
ID: 11868629
You will need to use frames then...  Or you might be able to use javascript (if all you want to do is change the options in a list or something depending on a selection...

Tim
0
 
LVL 2

Expert Comment

by:Twitchlet
ID: 11869603
You could use an iFrame for this, but be warned that it's going to knock your cross-browser compatability right out of the water.

What you do is place an iFrame somewhere on your page and give it the attribute [style="display:none"]. When you post to the server, set the name of the iFrame as your target. What you do then is have the server return a page of javascript to the browser inside the hidden iFrame. The script will then execute.

You can use DOM targetting in javascript to alter on-creen values provided that these values are within valid, named forms and each item that may be altered has a name.

For example, you could say have a hidden control variable change to the value 17, and have an onscreen select box change it's contents with the returned script below:

<script language="JavaScript">
  parent.theForm.controlVar.value = 17; //change value of hidden field
  parent.theForm.areaSelect.options.length = 0; //clear the previously held array of options

  //array of option names
  var options = new Array('option A', 'option B', 'option C');

  //array of option values
  var values = new Array('A','B','C');

  //grab a short handle on the select box
  var sBox = parent.theForm.areaSelect;
  for (i = 0; i < options.length; I++) {
    sBox.options[i] = new Option(options[i], values[i]);
  }
</script>

If you need more information about dynamic select boxes you can visit http://www.quirksmode.org/js/options.html.

Hope this helps.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a cohesive image for your brand is vital to making an impression on consumers. When the economy is tough, brands do better than unbranded  products. This can have a huge impact on your long-term profits, as the economy goes up and down.
In order to fulfill our mission of inspiring learning in the technology community, Experts Exchange is launching a Course of the Month program. Premium and Team Account members will have access to one course per month as a part of their membership, …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question