473,320 Members | 1,939 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Dynamically loading content onto a page?

hey all,
I'm a bit new to AJAX, and I was wondering how I could dynamically load content onto a page to prevent the user from having to reload the entire page, they'd just have to load the main content section that they want. Here's a page that I got my inspiration for this from: http://library.thinkquest.org/06aug/02048/. Try clicking on one of the tabs above the main content. You'll see a loading screen come up for a second, and then the new content will pop up. I was wondering if I could perhaps do this through frames? Is this the reccomended way to do this?
Just wanting some opinions. (and perhaps some help with AJAX once I get started on this)

Thanks.
Mar 11 '08 #1
3 1981
rnd me
427 Expert 256MB
you can use frames. you could also load the content to a script variable and then inject it into page using .innerHTML.


Expand|Select|Wrap|Line Numbers
  1. function IOStr(U){
  2. X=((!window.XMLHttpRequest)?new ActiveXObject('Microsoft.XMLHTTP'):new XMLHttpRequest);
  3. X.open('GET',U,!!0);
  4. X.send('');    
  5. return X.responseText;
  6. }
  7.  
  8. function el(tid) {
  9.     return document.getElementById(tid);
  10. }

using above functions as a code bank, inject "myDetails.htm" into a <div> tag with an id of details.
Expand|Select|Wrap|Line Numbers
  1. el("details").innerHTML=IOstr('myDetails.htm');
  2.  
Mar 11 '08 #2
Ah, ok.
Hmm... It would be useful if I could display "loading..." while the content is being loaded. How would this be possible?

Thanks.
Mar 12 '08 #3
acoder
16,027 Expert Mod 8TB
Use a span/div which contains the loading text and keep it hidden (style="display:none" or style="visibility:hidden") and then display before making the Ajax call (divElem.style.display = 'block') and then hide it again once complete.
Mar 14 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the web...
1
by: kanones | last post by:
Hi - I am seeing some performance degradation when I am loading a control dynamically onto a page with multiple other dynamical controls using Page.LoadControl versus dragging and dropping it...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
7
by: Samuel | last post by:
Hi, I am building a page that makes use of user control as a templating technique. The following is that I have in mind and it is actually working: Root/ -- login.aspx -- login.aspx.vb --...
3
by: Wouter | last post by:
Hi All, I am loading a web user control (.NET 2.0) into a placeholder on a content page ( plus the use of a master page). The controls is a list of companie, one you select a company for...
2
by: A.Wussow | last post by:
Hi Everybody, i want to load dynamically content from some user controls (with forms, or some data-controls) using atlas. So i use an UpdatePanel for loading the user control into a placeholder....
3
by: Yi Chen | last post by:
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include...
7
by: =?Utf-8?B?Li46OiBLZXZpbiA6Oi4u?= | last post by:
I have a problem with accessing controls that I have loaded dynamically and added to a web page. The scenario: I have a webpage that displays multiple instances of a user control on the page. ...
5
by: news.microsoft.com | last post by:
I'm strongly considering abandoning the one-physical-file-per-page model and going with an arcitecture that simply loads content from classes dynamically. There will be only one page that a user...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.