PDA

View Full Version : Ajax script error: POST method not allowed



b4greg
04-14-2008, 02:47 PM
1) Script Title: Ajax Tabs Content Script (v 2,2)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/

3) Describe problem:

I love this script, but I'm attempting to use it with a number of PHP calculators, and find that though it works fine in "#IFRAME" mode completely without errors, yet it fails when I try to use my PHP scripts with other modes. Though the other modes of "BASIC" and "DIV" do in fact succeed in calling and writing the PHP calculators as originally called, and each calculator is loaded appropriately and initially funcions within their seperate divs, when I then try to then calculate (the PHP script uses FORM and POST to input and output the results), I get an error, which is:

"Method Not Allowed
The requested method POST is not allowed for the URL /calculator/MortgageCalculators1/master-test.htm."

Is there a work around for this? Again, the PHP calculator scripts uses FORM for the input and POST for the output. Appriciate any help that can be given,

Thanks,

Greg

ddadmin
04-14-2008, 08:19 PM
I assume you're mainly running into trouble using the "Ajax" mode (versus "IFRAME") to get the contents of the calculator and have it function as expected? A link to the problem page would be helpful.

b4greg
04-14-2008, 09:32 PM
Yes... the IFRAME mode works fine, but the AJAX mode comes up with the above error.

Here's a temporary active link which demonstrates full compatability with IFRAME verses the error that I receive in AJAX mode. Please note that in AJAX mode, tabs 1, 2, and 3 call up the PHP caculators correctly, tab 4 calls up the demo external4.htm. The first three tabs will not function beyond being called up correctly. They do not execute the calculation.

http://www.trustkb.com/calculator/MortgageCalculators1/master-test.htm

Thanks again for looking into this.


Greg

b4greg
04-16-2008, 01:20 PM
Here's the link again:

http://www.trustkb.com/calculator/MortgageCalculators1/master-test.htm

ddadmin
04-17-2008, 04:01 AM
Looking at the source for one of your PHP calculators (ie: here (http://www.trustkb.com/calculator/MortgageCalculators1/calc-monthlypayment.php)), I see that it uses JavaScript for certain functions (ie: "calculators.js"). That's most likely the source of the problem. Pages fetched via Ajax will often "lose" the JavaScript included on the page, as Ajax basically cuts and pastes the fetched content onto the page without reinterpreting the JavaScript on it.

You can try manually adding any external .js and .css files referenced in your PHP calculator pages to the main page containing Ajax Tabs Content script, so they are always available. This may or may not work still, however:


<link href="calculators.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="calculators.js"></script>

b4greg
04-17-2008, 01:57 PM
Thanks very much for your suggestion, but as you guessed, it didn't work.... Ajax has its limitations.... That's another reason for prefering PHP. This script rewritten as an all PHP-function would likely work, but I'm afraid I'm not that skilled. The good news is that the IFRAME Mode works just fine, though it would be great to make use of the further versatility of AJAX. Thanks again for taking the time to look at the problem.

Greg