I have a PHP script which i want to pass a value in. So example.com/test.php?command=apple
. If that's entered then do its code. That all works grand in the server side but how do i accomplish this using an ajax call?
My code:
PHP:
<?php
if ($_GET['command']=='apples')
{
//do code
echo "hello";
}
?>
Jquery:
$.ajax({
url : '../command/test.php?command=apples'
}).done(function(data) {
console.log("result: " + data);
});