1

I am trying to run a PHP script from when submit button is clicked in my HTML code. I installed tomcat server on my remote linux server and its running fine. I even tested running sample PHP on it and its fine. I have tried below code on my local desktop and able to run the php script without any issues.

But when i run it from my remote linux server, the output when i am clicking the submit button is the PHP script itself on the page. Not able to understand exact mistake. Kindly guide me. Thanks.

 <button type="button" class="btn btn-success" id = "button" value="submit"  >Submit</button>

<script>
$(document).ready(function () {

    $('#button').click(function () {
        alert("first")
        $.ajax({

            type: "GET",
            crossDomain: true,
            url: "http://localhost:8085/ElitePass/login.php",
            data: {

                stime: $("#demo1").val(),
                etime: $("#demo2").val(),
                desc: $("#servername").val()
            },

            success: function(data){
                alert(data)
                $('#resultip').html(data);
            },
            error:function(data)
            {
                alert("Data sending failed");
            }
        });

    });
});
</script>
Goutam
  • 1,337
  • 8
  • 22
  • 41

1 Answers1

0

Your server is misconfigured and the pages are not being executed, you may have permission problems, and also if you want to go cross-domain you should take a look for CORS policies Take a look at this

question here about using PHP and TOMCAT

Community
  • 1
  • 1
AleMelo
  • 128
  • 4