Web Analytics Made Easy -
StatCounter trying to open php file from javascript - CodingForum

Announcement

Collapse
No announcement yet.

trying to open php file from javascript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • trying to open php file from javascript

    Hi guys i have an embedded game in an html (unity3D) and i am wanting to delete a file from my server.

    so at the moment i have a php file on my server and the html containing the javascript on my desktop.

    test.php
    PHP Code:
    <?php
    $conn 
    ftp_connect("ftp.domain.co.uk") or die("Could not connect");
    ftp_login($conn,"username","password");

    echo 
    ftp_delete($conn,"test.txt");

    ftp_close($conn);
    ?>
    I will out the correct domian name and username and password and this should delete a file named test.txt on my server.

    the problem i am having is calling this script from my javascript which is my main html:
    i have searched all over and found if i do this :
    Code:
    <script language="JavaScript">
            function DELETE_SERVER_FILE()
            {
                    dummyimage = new Image();
                    dummyimage.src ="http://www.domain.co.uk/test.php"
            }
    
    </script>
    But this is not working, can anyone help?

  • #2
    use AJAX:
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

    Comment

    Working...
    X
    😀
    🥰
    🤢
    😎
    😡
    👍
    👎