Jump to content

Archived

This topic is now archived and is closed to further replies.

jenspen

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

Recommended Posts

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.dhtmlgoodies.com/index.html?whichScript=ajax_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.longinodist.com/test/indexMAIN2.html
NON-WORKING SCRIPT: http://www.jenniferspengler.com/test/indexMAIN2.html

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

~Jen

Share this post


Link to post
Share on other sites
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::
[code]
<?php
    $http = new COM("MSXML2.ServerXMLHTTP");
    $http->open ("GET","http://www.otherdomain.com/page.php", false);
    $http->send();
    echo $http->ResponseText();

?>
[/code]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.