473,771 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ajax GET for URL fails

I am having trouble getting my simple AJAX program to work at my
current
University. Here is one of the programs that is giving problems. I
tried
it in and Mozilla/5.0 Gecko/20050923 under Fedora Linux

I see the alert's "V" and "V Two" The latter says
"null[XMLHttpRequest} aitivie sob ject undefined"
so I know that it retrieving the XMLHttpRequest object from the system.

It hangs after that; that is, I don't see "here get" alert.
Needless, to say, I confirmed with browser that the URL was available.

Thanks for any help you can provide. My students and myself were
excited
about doing AJAX in my Graphical User Interface class. I got it to
work
at another University when I was staying in another city, see below.
Thus, I was surprised and disappointed that it won't work here.

Dr. Laurence Leff, Pager 309 367 0787
Associate Professor of Computer Science, 1 University Circle
Western Illinois University Macomb IL 61455

<html>
<head>
<SCRIPT LANGUAGE="JavaS cript" >
var HO;
document.write( "Testingasd f");
function getRequestObjec t (){

xmlhttp = new XMLHttpRequest( );
alert ("null" + window.XMLHttpR equest + " acitvie sob ject " +
window.ActiveXO bject);
return xmlhttp ;
}

function Q () {
var code = HO.readyState;
alert (HO.readyState) ;
if (code == 4) {
alert ("code four")

var MyDocument = HO.responseXML;
var XXNode = MyDocument.getE lementsByTagNam e('xx');
var YYNode = MyDocument.getE lementsByTagNam e('yy');

xx = XXNode[0].firstChild.dat a;
yy = YYNode[0].firstChild.dat a;
document.QQ.xxR eceive.value = xx;
document.QQ.yyR eceive.value = yy;
}


}
function V () {
alert("v");
HO = getRequestObjec t();
alert ("V Two" + HO);
HO.open("GET"," http://www.wiu.edu/users/mflll/U.xml");
alert ("here get" + HO+"|" );
HO.onreadystate change=Q;
alert (" ho onready statechange")
HO.send(null);

}
</script>
</HEAD>
<BODY>
<P>
Text before Form
<P>
<form name="QQ" >
<input TYPE = "BUTTON" NAME="qq" VALUE="PressMe"
onClick="V()" />
<input TYPE="text" name="xxReceive "/>
<INPUT TYPE="text" name="yyReceive "/>
</form>
</BODY>

The program below worked under an older version of internet explorer
at another University near where I was staying with my mother that let
me use
their computer as a courtesy.

It does not work now under a more current version of Internet Explorer.

<html>
<head>
<SCRIPT LANGUAGE="JavaS cript" >
var HO;
document.write( "Testingd") ;
function getRequestObjec t (){
try {
xmlhttp = new ActiveXObject(" Msxml2.XMLHTTP" );
}
catch (e) {
try {
xmlhttp = new ActiveXObject(" Microsoft.XMLHT TP");
}
catch (E) {
alert ("second catch");
}
}
return xmlhttp ;
}

function Q () {
var code = HO.readyState;
alert (HO.readyState) ;
if (code == 4) {
alert ("code four")

var MyDocument = HO.responseXML;
var XXNode = MyDocument.getE lementsByTagNam e('xx');
var YYNode = MyDocument.getE lementsByTagNam e('yy');

xx = XXNode[0].firstChild.dat a;
yy = YYNode[0].firstChild.dat a;
document.QQ.xxR eceive.value = xx;
document.QQ.yyR eceive.value = yy;
}


}
function V () {
alert("v");
HO = getRequestObjec t();
HO.open("GET"," http://www.wiu.edu/users/mflll/U.xml");
alert ("here get")
HO.onreadystate change=Q;
alert (" ho onready statechange")
HO.send(null);

}
</script>
</HEAD>
<BODY>
<P>
Text before Form
<P>
<form name="QQ" >
<input TYPE = "BUTTON" NAME="qq" VALUE="PressMe"
onClick="V()" />
<input TYPE="text" name="xxReceive "/>
<INPUT TYPE="text" name="yyReceive "/>
</form>
</BODY>

Feb 3 '06 #1
1 2143

mf***@wiu.edu wrote:
<SCRIPT LANGUAGE="JavaS cript" >
The language attribute is deprecated, use the type attribute instead:

<script type = "text/javascript">
function getRequestObjec t (){

xmlhttp = new XMLHttpRequest( );
alert ("null" + window.XMLHttpR equest + " acitvie sob ject " +
window.ActiveXO bject);
return xmlhttp ;
}
In this current implementation of your function, you're only supporting
non-IE browsers (at least until IE7 comes out). You can do something
like the following:

if(window.XMLHt tpRequest)
{
//for IE7, Mozilla, Safari, etc: use native object
var xmlHttp = new XMLHttpRequest( );
}
else if(window.Activ eXObject)
{
//use ActiveX control for IE5.x and IE6
var xmlHttp = new ActiveXObject(" Microsoft.XMLHT TP");
}
document.QQ.xxR eceive.value = xx;
document.QQ.yyR eceive.value = yy;
A more standard way of accessing the form and its elements is through
the square bracket notation:

document.forms["QQ"].elements["xxReceive"].value = xx;
document.forms["QQ"].elements["yyReceive"].value = yy;
HO.open("GET"," http://www.wiu.edu/users/mflll/U.xml");


The open method also has a third parameter that takes a boolean
indicating whether you would like this to be an asynchronous request or
not. Usually true is passed.

Feb 3 '06 #2

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

Similar topics

9
15082
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
1
2105
by: nx.nine | last post by:
hi, i've done some searching and haven't found a solution that worked, hopefully someone here can help. i apologize in advance for my dyslexic thought process. i have an xml file being transformed by an xsl file, the xsl outputs an html page that then loads other xml via ajax and applies an xsl to draw a user interface. firefox does everything perfectly, but when ie tries to start my ajax
5
2221
by: Martin | last post by:
Hello NG, I've been doing some AJAX for a few weeks now. The basics worked fine so far, but now I've got the following problem which I can't solve: With AJAX you typically update/replace only parts of your page. But in my application there are situation when I first notice on the server -- so AFTER sending an AJAX request -- that I have to update the complete page instead of only some parts. And what do I do now???
3
3681
by: David Prentice | last post by:
I am having dificulty debugging an ASP.NET Ajax (Novemver CTP) app on windows vista RTM. I have found the following interesting facts but cannot join the dots . . If my application is configured to run in the Classic .NET App pool, when I hit F5 in visual Studio 2005 I can successfully debug my application, however partial rendering using an update panel does not work (I have discovered that the script resource handler is causing a...
10
1686
by: sfmcfar | last post by:
Hi, Can someone recommend an Javascript toolkit that provides both AJAX- like requests and effects, and that supports IE 5.5+, Firefox 1.5+, and Netscape 7+? I know that NS7 may not be as functional as the others, but I need a toolkit that at least provides some semblance of compatibility - instead of a fade out, for example, NS7 would just simply close the window. Thanks in advance,
2
1997
by: m.schaeffer | last post by:
Hello, my problem is, that if i create a new website with Visual Studio 2005 and I choose "AJAX enabled Website" everything works fine. But if I try to do the same with an existing Website (AJAX Extesions where installed later) the "AJAX"-functionality fails. Though I have the AJAX Extensions in my Tool-Box and everything seems ok it doesn`t work. I can drag and drop ScriptManager, UpdatePanels, ContentTemplates ... but when I run the...
3
1783
by: krg | last post by:
Hi, I started writing this blog some time back and it would be great if I could get an audience here and even better if we could have a conversation about developments possible on the techniques I have discussed in my blog. Automatic Javascript Bug Reporting Using AJAX http://krahulg.wordpress.com/2007/12/24/automatic-javascript-bug- reporting-using-ajax/]
3
17696
by: George | last post by:
I am doing an AJAX call using JQuery on my page to which returns JSON objects and everything works fine. Now I decided to use ashx handler instead of and simply write JSON out. Then my problems begun. So here is JQuery call $.ajax({ type: 'POST', url: url,
2
2857
by: ArizonaJohn | last post by:
Hello, Below I have some Ajax and the page it points to. This code works great if $_SESSION has no spaces in it (for example, if it is "elpaso"). However, if $_SESSION has a space in it (for example, "el paso"), then the Ajax fails. What can I do to make this Ajax work when $_SESSION has a space in it? Thanks. Ajax: <?php
0
9619
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
9454
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,...
1
10038
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
9911
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
7460
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
5354
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
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
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.