\
I am new at this and I need some help. \
I want to create a Cordova project which is supposed to do this. On the main page there's a "Send"
button, when I click on it an ajax request should be sent to the the php file and it should return
"hello", and in the success function the result is alerted. Instead of that it alerts the whole PHP
file. This only happens when I run Cordova on browser with cmd. \
I tried to execute it like I would execute a php file and it worked, so I don't really understand what's
the problem here. \
Sorry for my bad English, but I hope that by looking at the photos you'll understand my problem.\
Help me Obi-Wan Kenobi, you're my only hope.\
alert.php
<?php echo json_encode("HELLO"); ?>
index.js
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
// Cordova is now initialized. Have fun!
console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
document.getElementById('deviceready').classList.add('ready');
}
function send(){
$.ajax({
type:"get",
url: "alert.php",
success: function(result){
alert(result);
}});
}
document.getElementById("send").addEventListener("click",send);
https://i.stack.imgur.com/Pwl5m.png
after accessing http://192.168.0.111/Project/www/alert.php https://i.stack.imgur.com/q7BXK.png