Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prototype Problem

Status
Not open for further replies.

jaschulz

Programmer
May 20, 2005
89
FR
Even though I use only:

Ajax.updater

and

Ajax.request

my server gives the following error:

Method Not Allowed
The requested method POST is not allowed for the URL /MyDir/testfile.htm.

Apache/1.3.37 Server at Port 80

In fact, I am not posting or changing anything on the server, so I don't see where this error comes from.

Any ideas?

Thanks,

JAS
 
It appears that you are sending a post request instead of a get request via the ajax call. .htm files are supposed to be STATIC and NON-EXECUTABLE, but in order to process a post request you need an executable program on the server. I think that is what the server is telling you.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
I know. That's what it looks like to me, too. But, in fact, I am not trying to post anything, I am just reading reading the html files and using them to update the displayed page (i.e. the usual Ajax trick).

I have had a look at the prototype.js source, but I confess, I don't understand it very well.

Any other ideas?

JAS
 
And yet, you're right. It turns out that unless I specify 'get' in the prototype Ajax call, it tries to do a post, even though I have nothing to post. I don't understand it at all, but at least it's working now.

Thanks,

JAS
 
I'll probably get flamed for violating some standard of which I am unaware, but I'll say it anyway: you can use GET to modify data as well. Where POST requires an executable, GET does not, but it CAN call an executable - that's why you can pass parameters via the querystring. Only an executable is able to use those paramters. I frequently use GET to call a program that makes changes to data on the server. My choice between using GET or POST is primarily based on which one is easier for what I need to do. GET is easier if I only need to pass one or two short paramters, POST is better if I want to send a whole form full of data.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top