473,750 Members | 2,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AJAX page loading

I'm new to AJAX programming (and JavaScript), but I've been picking up
the idea pretty quick. I have a question though. With the project
that I'm working on, I would like to have the main page loaded
dynamicly. Right now, it's just a php script that loads the
information when it's called. But, I can see some problems cropping
up. What I want to do is call the php scripts when the page loads via
JavaScript/AJAX. I'm just not sure what the best way to do this would
be. I was thinking that I could create multiple XMLHttpRequest
objects, and just modify my scripts to use different XMLHttpRequests .
Would this be the best way to do this?

Feb 23 '06 #1
11 15171
pa***********@g mail.com wrote:
I'm new to AJAX programming (and JavaScript), but I've been picking up
the idea pretty quick. I have a question though. With the project
that I'm working on, I would like to have the main page loaded
dynamicly.


Don't to such mistake of changing html by JavaScript!

JavaScript *is* and *should* stay as an aditional feature.
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Feb 23 '06 #2
I wasn't planning on using JavaScript to change the html (I'm guessing
you mean an explicit change in the javascript) Or, do you mean (as I
am planning) don't change the html via the XMLHttpRequest object?
This is what I would like to do, idealy:
user gets to main page
basic page is most likely blank, or has very little
using onLoad (probably), call functions to load the information
- these use XMLHttpRequest to call a php script, which does the
work.
the results are then loaded into their respective <div id> tags

Is this what you are saying, don't do?

Feb 23 '06 #3
Jonas Raoni <jo********@gma il.com> wrote in news:dtkqjj$ci4 $3
@emma.aioe.org:
pa***********@g mail.com wrote:
I'm new to AJAX programming (and JavaScript), but I've been picking up
the idea pretty quick. I have a question though. With the project
that I'm working on, I would like to have the main page loaded
dynamicly.


Don't to such mistake of changing html by JavaScript!

JavaScript *is* and *should* stay as an aditional feature.


Crazy talk.

It depends on what you are building. If you know your audience, or your
app/page is specific to a type of user, then GO AHEAD!

To suggest that one should not use Javascript to modify the DOM is
outrageous. That's what the DOM is for. Using the two together can bring
real use and LIFE to a web page.

In the web apps I've designed, DOM-manipulation is both helpful and
necessary.

If you know your audience (ie: that they will have javascript enabled), why
limit what you can/can't do with javascript?!?!? ?!

Feb 23 '06 #4
pa***********@g mail.com wrote:
This is what I would like to do, idealy:
user gets to main page
basic page is most likely blank, or has very little
using onLoad (probably), call functions to load the information
- these use XMLHttpRequest to call a php script, which does the
work.
the results are then loaded into their respective <div id> tags

Is this what you are saying, don't do?


Yeah, people that love JavaScript are totally against using it this way
hehe :)

But I didn't asked you to not use the XHR object, I just said to not
forget the poor browsers and build everything with JavaScript.

You should load everything as pure html and add the JavaScript
behaviours to your content.

Ex of a tree-menu:

1. First load everything as html, forget about JavaScript...
<ul>
Parent Node
<li><a href="deep.abc? parent=1">Child Node A (has children)</a></li>
<li>Child Node B</li>
<li><a href="deep.abc? parent=1">Child Node C (has children)</a></li>
</ul>

2. Parse your menu-structure and add your "AJAX" stuffs to load the
sub-items without refreshing the page.

This way, if the user doesn't have JS enabled, he will be able to
navigate using the simple and always functional html ;]
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Feb 23 '06 #5
Good Man wrote:
Jonas Raoni <jo********@gma il.com> wrote in news:dtkqjj$ci4 $3
JavaScript *is* and *should* stay as an aditional feature.


Crazy talk.

To suggest that one should not use Javascript to modify the DOM is
outrageous. That's what the DOM is for. Using the two together can bring
real use and LIFE to a web page.


You didn't understood what I said, read the message that I've just sent
to this thread and you'll get my point of view, if you don't agree with
me again, I'll cut my head off hahaha xD
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Feb 23 '06 #6
Ahh, I understand now. The only thing is that there are things that
will need to update. Basicly, I'm making a game, and what I'm talking
about is the main game page (after logging in). The part of the screen
where everything is happening will need to be updated frequently, as
will other things, like menu, and stats. I'm not sure if there is a
good way to get around that, without refreshing the screen.
As for someone getting around if they don't have JS enabled... I don't
think they'd be able to do too much anyway, just because of the nature
of what I was wanting to do, but I could be wrong. Like I said, I'm
new to most of this, so I'm not sure of the capabilities quite yet.

Feb 23 '06 #7
pa***********@g mail.com wrote:
Ahh, I understand now. The only thing is that there are things that
will need to update. Basicly, I'm making a game, and what I'm talking
about is the main game page (after logging in).


[..]

Ah, if it's a JavaScript game, there's no problem, since it requires
JavaScript anyway...

I'm just against "html genocide" on pages that don't really need
JavaScript to work fine. And some people really do such things... This
is what I'm talking about:
<URL:http://rialto.applicat ion-servers.com/demoRialto.jsp> .
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Feb 23 '06 #8
Dang... I'm new to this, and even I know that's not a good idea. That
could be done so much better with normal HTML and a lot less JS.
Even mine wouldn't be that bad. Mine is mainly just pulling the pages,
maybe a few fun/fancy things, but that can come later.
Back to my original question though, what would be the best way to call
multiple pages like I want? Just have a number of XHRs?

Feb 23 '06 #9
pa***********@g mail.com wrote:
Dang... I'm new to this
You're not alone, me too :]
and even I know that's not a good idea. That
could be done so much better with normal HTML and a lot less JS.
Yeah haha, that's a bizarre project... Turn off the JavaScript, you'll
see nothing but a blank screen. The guy literally done what I can call
"<html><scr ipt src="DO-EVERYTHING.js"> </script></html>"

But at least here, people love to use those "desktop frameworks", they
come from desktop languages and refuse to learn how the web works.

Back to my original question though, what would be the best way to call
multiple pages like I want? Just have a number of XHRs?


Yes, that's it, a set of requests... Read some links and you'll see that
there are only two ways of requesting data, the asynchronous and the
synchronous way. Choose the asynchronous one, which will allow you to
load the documents at the same time without killing the browser.

The other method stops the script flow until it finishes loading the
request (so imagine what a bad connection can do hehe).
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Feb 23 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
15081
by: Eric Wallstedt | last post by:
I have a page that "logs" changes made to input fields using ajax to pass data to a cgi. I use POST and it works fine most of the time (all the time in IE). But it fails when I get the data from a popup that invokes a function that in turn invokes ajax. Scenerio 1. user clicks a button to create a popup 2. the user selects a select member and clicks a button and a
2
2217
by: jason.m.ho | last post by:
Hello! I am trying to build an ajax chat system. Currently I have it so that when you chat, you upload your message to the database, and each client is polling that database to see if he/she has any new messages. The problem with this is that I poll at 2 second intervals (since connection is not active), and so its not as responsive as I'd like it to be. My question is, is an active HTTP connection possible? How did Meebo or Gmail...
1
16510
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX - microlink pattern tutorial : A microlink is a link that opens up
1
4033
by: geevaa | last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3 XMLHttpRequest and AJAX for PHP programmers James Kassemi Introduction: Although the concept isn't entirely new, XMLHttpRequest technology is implemented on more sites now than ever. Compatibility is no longer an issue (IE, Mozilla and Opera all support it), and the benefits to using it are amazing. There are too many PHP programmers avoiding any
13
4005
by: Marvin Zhang | last post by:
Hi, I'm not familiar with web programming, but I have a problem here. I have a page. When a user click one button on it, I will use AJAX to request a PHP script which will do a bunch of tasks, asynchronously. These tasks might take long time so I want to keep the user informed of the progress. The problem is that only the PHP script knows the progress, how can the web page gets these information from PHP script?
10
8007
by: shankwheat | last post by:
I'm experimenting with using a AJAX style "processing" icon. The process I'm running in the background with xmlHttp is intensive and takes a 5--10 secs to complete. Instead of my processing icon appearing in the page, the page just freezes during the process until it's finished. Is this the best way to display this kind of icon? What can I do so this works right? Thanks function stateChanged() { if (xmlHttp.readyState == 0)
5
3107
by: simon | last post by:
hello, I have a server set up on my local (home) network and can not get an ajax application to run on the box. it works fine on our developement server and also works fine locally. I copied the application to the server, setup the website, installed the ajax extensions, also loaded/enabled front end extensions so i could load the site in visual studio 2005. when i attempt to run the site, either from the server or from another pc...
11
3044
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have run into a situation that if a page/tab that uses the Ajax toolkit (using .net version 3.5) is closed before the Ajax enable controls complete loading, then IE locks up. Does it in both IE7 and IE8. There is no issue when the controls are allowed to complete loading. Can you please tell me the best practice that handles this? Thanks.
29
8171
by: canabatz | last post by:
Hello , i got this code that works great , now i want to have it refresh every 4 seconds , where can i put the timer to do that? i realy need help!! thanx!! <script type="text/javascript"> //Global vars to hold connection to web pages var request;
29
24410
by: FreshRob | last post by:
I have been trying to fix this issue the whole of today and have gotten no where. I am developing a new website, and wanted it to display a webpage in lightbox and have an external page added to the main page, both worked successfully apart, but it wasn't until I combined them that I have had an issue. My aim was to have ajax add the external page into a div and then load lightbox from that div, though that is where the problem lies as I can...
0
8836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9394
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9338
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6803
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4712
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.