-
Ajax Simple Question - Please Help -- Very Frustrated
I am new to Ajax and decided to add it to my blog site but for the life of me i cant figure out why it keeps returning an error message in both IE and Firefox. The code is on Blogger.com but when i move it to another server it works fine. Here have a look I have put the code onto this test blogger site for you to try:
There are several alert boxes to help tell you where things are....And here is the code i am using on that page:
Code:
<script type='text/javascript'>
var c;
function o()
{
if(c==undefined)
{
c=0;
try
{
alert("Starting Ajax call...");
var vv = ax("http://z2.awardspace.us/1.js");
alert("Ajax call Returned - No Error - Parsing Data: ["+vv+"]");
if (vv.length == 4)
{
c = parseInt(vv.substring(2,3));
alert("Ajax Call Successful");
}
else
{
alert("Ajax Call Returned unexpected data content");
}
}
catch(ee4)
{
alert("Ajax Call Failed - Catch:" +ee4);
}
}
}
function ax(url)
{
var xhr;
try
{
xhr = new ActiveXObject("Msxml2.XMLHTTP");
alert("USE: IE Ajax API");
}
catch (ee1)
{
try
{
xhr = new ActiveXObject("Microsoft.XMLHTTP");
alert("USE: IE Ajax API");
}
catch (ee2)
{
try
{
xhr = new XMLHttpRequest();
alert("USE: Firefox/Safari Ajax API");
}
catch (ee3)
{
xhr = false;
alert("No Ajax capability");
}
}
}
if (xhr)
{
alert('CALLING: Ajax .open()')
xhr.open('GET', url, false);
alert('DONE: Ajax .open()');
alert('CALLING: Ajax .send()')
xhr.send(null);
alert('DONE: Ajax .send()');
return xhr.responseText;
}
else
{
return "";
}
}
</script>
Last edited by quantass; 03-26-2010 at 06:55 PM.
-
Moved To The Ajax Section
What errors are you getting?
-
ajax does not work cross domains... If it does, I do not know how it does, I have never been able to get it to work, I have heard it does not work across domains though. maybe I heard wrong, but like I said, never been able to get it to work myself...
Similar Threads
-
By Andrew Murphy in forum VB Classic
Replies: 1
Last Post: 09-03-2002, 01:17 AM
-
Replies: 0
Last Post: 03-21-2001, 05:01 PM
-
Replies: 0
Last Post: 11-04-2000, 03:57 AM
-
By Alex Nitulescu in forum VB Classic
Replies: 1
Last Post: 10-21-2000, 05:13 AM
-
By Gary McCallum in forum Java
Replies: 2
Last Post: 10-20-2000, 11:20 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|