•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 426,662 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,517 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1211 | Replies: 3
![]() |
•
•
Join Date: Aug 2006
Location: Noida, India
Posts: 158
Reputation:
Rep Power: 3
Solved Threads: 17
First I want to tell u if u want the whole page to refresh, then there is no need to use ajax. U just have to write a function which will load ur page every pireod of time..
Ajax is used to update small portion of the page in background without waiting for hole page to get refresh. You can use ajax to make ur page user-intractive, by peforming some small task in the backgound while the user is free to intract with the page.
Best example is: there is web page to display weather reports of various cities, and if user selects a city, the weather details corresponding to that city should be loaded in a div.
And here is where the real power of ajax comes. You can creata function which send an ajax request and get the weather details from server back to client, and according to data u can update the div with new value (Temp, images etc.) without refreshing the whole page. And what more, a second request is generated a regular interval to update the current temp of ur current location. in this way so many changes are going on the page without refreshing full page. And user also get a good feeling.(who wants to wait for whole page to load again)
Ajax is used to update small portion of the page in background without waiting for hole page to get refresh. You can use ajax to make ur page user-intractive, by peforming some small task in the backgound while the user is free to intract with the page.
Best example is: there is web page to display weather reports of various cities, and if user selects a city, the weather details corresponding to that city should be loaded in a div.
And here is where the real power of ajax comes. You can creata function which send an ajax request and get the weather details from server back to client, and according to data u can update the div with new value (Temp, images etc.) without refreshing the whole page. And what more, a second request is generated a regular interval to update the current temp of ur current location. in this way so many changes are going on the page without refreshing full page. And user also get a good feeling.(who wants to wait for whole page to load again)
Last edited by Luckychap : May 26th, 2008 at 7:43 am.
When you think you have done a lot, then be ready for YOUR downfall.
•
•
Join Date: May 2008
Posts: 14
Reputation:
Rep Power: 1
Solved Threads: 0
•
•
•
•
First I want to tell u if u want the whole page to refresh, then there is no need to use ajax. U just have to write a function which will load ur page every pireod of time..
Ajax is used to update small portion of the page in background without waiting for hole page to get refresh. You can use ajax to make ur page user-intractive, by peforming some small task in the backgound while the user is free to intract with the page.
Best example is: there is web page to display weather reports of various cities, and if user selects a city, the weather details corresponding to that city should be loaded in a div.
And here is where the real power of ajax comes. You can creata function which send an ajax request and get the weather details from server back to client, and according to data u can update the div with new value (Temp, images etc.) without refreshing the whole page. And what more, a second request is generated a regular interval to update the current temp of ur current location. in this way so many changes are going on the page without refreshing full page. And user also get a good feeling.(who wants to wait for whole page to load again)
thanks for your reply
here i paste my coding, but it has some error.
i don't where is the mistake.
cna you help me to sole that.
html Syntax (Toggle Plain Text)
<html> <head> <script> function loadXMLDoc(url) { // code for Mozilla, etc. if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest() xmlhttp.Open("GET","index.jsp",true) xmlhttp.Send(null) xmlhttp.onreadystatechange=state_Change } // code for IE else if (window.ActiveXObject) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP") if (xmlhttp) { xmlhttp.open("GET","index.jsp",true) xmlhttp.Send() xmlhttp.onreadystatechange=state_Change } } } function init() { window.setTimeout( "loadXMLDoc( \"index.jsp\" );", 1 ); // OR // window.setTimeout( "loadXMLDoc( \"page.php?req=true\" );", 3000 ); } </script> </head> <body onload="init();"> <div> <tlds:first bgColor="#385CA8" color="WHITE" fontSize="12" dateColor="yellow" width="1398" fontList="Arial" latitudeDeg="12" latitudeN="58" longitudeDeg="77" longitudeN="38" align="Center" > LEMS </tlds:first> </div> </body> </html>
Last edited by peter_budo : May 31st, 2008 at 6:12 am. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Mar 2008
Posts: 117
Reputation:
Rep Power: 1
Solved Threads: 13
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest()
xmlhttp.Open("GET","index.jsp",true)
xmlhttp.Send(null)
xmlhttp.onreadystatechange=state_Change
}should be
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest()
xmlhttp.open("GET","index.jsp",true)
xmlhttp.send(null)
xmlhttp.onreadystatechange=state_Change
}U were using captial letters for open and send
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- How to 'refresh' a php page? (PHP)
- WEIRD! php pages do not load unless i hit refresh (PHP)
- How to change video refresh rate ? (Window and Desktop Managers)
- IE Refresh Issue (Web Browsers)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: display:block to show a table?
- Next Thread: Dynamically resize iframe containing php


Linear Mode