Jump to content


Photo

Ajax works on one domain host; not on another? -- perpetual waitmessage *SOLVED*


  • Please log in to reply
4 replies to this topic

#1 jenspen

jenspen
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 26 October 2006 - 07:01 PM

Please pardon me if my post is redundant in any way; I've searched awhile for the answer to this, and, as yet, I am still in the dark.

I was testing a "dynamic div" type script that I found at http://www.dhtmlgood...dynamicArticles which uses ajax (my first ajax attempt at all).

I had to alter the thing a little to remove one misplaced "div" tag in the html portion.  Other than that, I left everything the same (for testing purposes, but I'm hoping to learn from it and create something similar).

Here's the thing:  I first uploaded it to one of the domains I maintain (hosted by uslec), and it worked like a charm (only the first link works, though; it's the only one I truly included.  The rest of the "articles" don't exist at this time).  Happy that it worked, I decided I'd put it on my personal domain as well (hosted by godaddy) using EXACTLY THE SAME DIRECTORY STRUCTURE AND FILENAMES... and... it didn't work... ????  WHY?!  All I get is a perpetual waitmessage (onloading message).  Is it something having to do with protocols or webserver applications?  Pardon my ignorance; I'm a newbie. :)

Everything is identical... I can't figure this out!... can anyone help????!?!?!

WORKING SCRIPT: http://www.longinodi...indexMAIN2.html
NON-WORKING SCRIPT: http://www.jennifers...indexMAIN2.html

Thank you, thank you, thank you - IN ADVANCE!! :)

~Jen

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 27 October 2006 - 07:26 PM

If I read your problem correctly, you are trying to send an xmlhttp.request from javascript in a page on one domain to invoke a script in another domain and not having any success.

As a workaround you can invoke a local php script from your js script and send the xmlhttp request from that php script

::localscript.php::
<?php
     $http = new COM("MSXML2.ServerXMLHTTP");
     $http->open ("GET","http://www.otherdomain.com/page.php", false);
     $http->send();
     echo $http->ResponseText();

?>

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 jenspen

jenspen
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 29 October 2006 - 10:00 PM

Actually, everything I need is on the same domain (the file it's trying to retrieve is actually even in the same directory) and no requests are being made outside of it.

I actually know more about the problem now; I downloaded firebug, and I found out the error sent by the server:

--
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>405 Method Not Allowed</TITLE>
</HEAD><BODY>
<H1>Method Not Allowed</H1>
The requested method POST is not allowed for the URL /test/bottom.html.<P>
<HR>
<ADDRESS>Apache/1.3.33 Server at jenniferspengler.com Port 80</ADDRESS>
</BODY></HTML>
--

Have any ideas about how to get around that?

Your idea may still be a good workaround, but I'm not savvy enough to put it into motion, because I'm not sure what variable to reference (or HOW to reference it) in the php script so that it will know exactly which file to retrieve, since there will be multiple possible requests, and all must go through the same script.

The server version I'm on is Apache 1.3.33 and I'm wondering if that has something to do with the problem.  The version of the server on which the script works is something like 2.1.57 (don't have the info in front of me).

What do you think?!

(Thanks for your help thus far.)
~Jen

#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 29 October 2006 - 10:14 PM

To be honest, I'm not sure what the error message means, but my first reaction on reading it was to try GET method instead of POST and see if that works.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#5 jenspen

jenspen
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 29 October 2006 - 11:03 PM

Gosh!  HOW SIMPLE!!  And... EFFECTIVE!

Barand, this seems to have done the trick... thank you, thank you, thank you.

I'll see if anything crazy happens, but for now, it appears the problem is "solved."

Y'all can mark this one "resolved" now. :)

~Jen




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users