#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    12
    Rep Power
    0

    Question PHP and coldfusion


    hi guys,

    quick question,

    if i call a php file from ajax within javascript in coldfusion will it work without installing anything?

    if yes, how come the below is giving me "method not allowed"

    test.cfm

    <!doctype html>
    <html>
    <head>

    </head>
    <body>
    <h1>Take screenshot of webpage with html2canvas</h1>

    <input type='button' id='but_screenshot' value='save screenshot' onclick='exportAndSaveCanvas();'><br/>
    <script type="text/javascript" src="SCRIPTS/jquery-2.1.0.min.js"></script>
    <!-- Script -->
    <script type='text/javascript'>


    function exportAndSaveCanvas() {
    try
    {


    // AJAX request
    $.ajax({
    type: 'POST',
    url: 'export.php',

    success: function(data){
    alert('Upload successfully');
    },
    error: function(XMLHttpRequest, textStatus, errorThrown) {
    alert("Status: " + textStatus+ "\nError: " + errorThrown);
    }
    }); //ajax

    }
    catch(err)
    {
    alert('DBconnect: '+err.message);
    return 'err';
    }
    } // End exportAndSaveCanvas()
    </script>

    </body>
    </html>

    export.php

    <?php
    $message = "in php";
    echo "<script type='text/javascript'>alert('$message');</script>";


    ?>
  2. #2
  3. Headless Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,939
    Rep Power
    9647
    You have something installed (like CF) that is intercepting the request to /export.php and deciding that POST methods aren't allowed to it. Either exempt that file, or configure whatever it is so it knows that POSTs are okay.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    12
    Rep Power
    0
    Originally Posted by requinix
    You have something installed (like CF) that is intercepting the request to /export.php and deciding that POST methods aren't allowed to it. Either exempt that file, or configure whatever it is so it knows that POSTs are okay.
    this sounds plausible, but how do you do that?
  6. #4
  7. Headless Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,939
    Rep Power
    9647
    I don't know your application. I have no idea what it is or how it's set up. You need to look into how it works and find out what part of it is responsible. I can give you pointers and suggestions and advice but I can't give you the answer.

IMN logo majestic logo threadwatch logo seochat tools logo