473,805 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem in read content file on the server with ajax

oranoos3000
107 New Member
hi
i have a script that with click a button in this script text with id="targetDiv"
is substitute with content of the file data.txt.
this script and data.txt are on the same directory on my local disk
my problem is that with pressing button on this script this is not substituted
and XMLHttpRequestO bject.status instead of 200 is 0
what is meaning of XMLHttpRequestO bject.status instead equal to zero?
how can i change XMLHttpRequestO bject.status to 200?

my script is:

Expand|Select|Wrap|Line Numbers
  1. <html> 
  2.   <head> 
  3.     <title>Ajax at work</title> 
  4.  
  5.     <script language = "javascript">
  6.       var XMLHttpRequestObject = false; 
  7.  
  8.       if (window.XMLHttpRequest) {
  9.         XMLHttpRequestObject = new XMLHttpRequest();
  10.       } else if (window.ActiveXObject) {
  11.         XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
  12.       }
  13.  
  14.       function getData(dataSource, divID) 
  15.       { 
  16.         if(XMLHttpRequestObject) {
  17.           var obj = document.getElementById(divID); 
  18.           XMLHttpRequestObject.open("GET", dataSource); 
  19.  
  20.           XMLHttpRequestObject.onreadystatechange = function() 
  21.           { 
  22.             if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { 
  23.                 obj.innerHTML = XMLHttpRequestObject.responseText; 
  24.             } 
  25.           } 
  26.  
  27.           XMLHttpRequestObject.send(null); 
  28.         }
  29.       }
  30.     </script>
  31.   </head> 
  32.  
  33.   <body>
  34.  
  35.     <H1>Fetching data with Ajax</H1>
  36.  
  37.     <form>
  38.       <input type = "button" value = "Display Message" onclick = "getData('data.txt', 'targetDiv')"> 
  39.     </form>
  40.  
  41.     <div id="targetDiv">
  42.       <p>The fetched data will go here.</p> 
  43.     </div> 
  44.  
  45.   </body> 
  46. </html>
my browser is internet explorer 4.0
and i run this script on windows NT 5.1
thanks very much
Jul 11 '09 #1
1 1649
Dormilich
8,658 Recognized Expert Moderator Expert
@oranoos3000
are you sure that IE 4 actually supports AJAX? I mean, IE 6 is still a programmer's nightmare but IE 4… that's more than 10 years ago (and personally I didn't expect it to be used any more)
Jul 12 '09 #2

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

Similar topics

10
6877
by: greenb | last post by:
Our asp.net web app uses a .NET component (DLL) in the bin directory to call several stored procedures back to back to perform updates. They don't return any data. Sometimes the total execution time can take 2-3 minutes, but even though I have set the executionTimeout in web.config to a high number of seconds (2400), the request will still time out after 90 seconds. The user sees a Request timed out error. The app logs a ThreadAborted...
42
34252
by: Greg | last post by:
Hi, I've designed a bookmark in Ajax / PHP that I will put soon on sourceforge.net. But I've got an very tricky bug. I try it on some computers with Internet Explorer/Windows, Firefox 1.07/Linux, Firefox 1.5/Linux, Firefox 1.5/Windows and Firefox 1.5/Mac, Safari/Mac. It works perfectly on a lot of configurations but, on some PC with Firefox 1.5/Windows (not all), the Javascript code with XmlHttpRequest
5
4100
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in both projects. Both controls(dlls) have been signed using SN.exe and I've set up the appropriate .Net assembly permissions using those Strong Names The DLL's have been copied to the /bin directory in both web virtual directories.
2
1864
by: Alex | last post by:
Example uploaded to: http://www.clickatus.com/ajax/ BTW - This is for FIREFOX, won't work in IE. I don't know why but when it is executed the browser still in loading state... Even though XMLHttpRequest already got its string from the server... Any help?
1
1774
by: JohnnieTech | last post by:
I am using some javascript/ajax to load content into a main div. The problem I am running into is that it will work in IE but not in FF. In FF I don't get any sort of load at all. I have a 1 column 2 row setup in css. The links are in the top div and the content loads in the main div. The only problem I thought may have been causing it was that I had an ID inside of and ID. I changed my links div to a class instead of an ID and that didn't...
2
3174
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if i change something in php file using in ajax function.it not refreshed,means its shows the previous result it not get updated.i can't understand whats the prob.this is the code i m using: <? include("config.inc.php"); //error_reporting(0); ...
1
2988
by: hesameagle | last post by:
Hi I want to use ajax to connect to database and echo some data in my page, I wrote these two codes that can handle my need: index.php ----------------------------------------- <?php //This file is text.php
12
1269
by: sheldonlg | last post by:
Here is my situation. I am coding in an AJAX framework for an intranet application behind a vpn. Therefore, I can't give you a URL for the actual app. I made a sample app for viewing and am looking for ideas. The sample app is at www.sheldonlg.com/currentPeriod.htm. This sample app does NOT exhibit the problem. I put it there so that I can talk to the you about the problem. In the actual app, initially a bunch of empty divs are...
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
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
10368
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
10107
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...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
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
6876
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
5544
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...
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.