I currently have this code below working A-OK, it basically loads up a pretty notification box with a message on a onClick event, so when a user presses the button then the notification pops :
<button id="buttonsuccess" class="btn btn-success" onClick="FunctionSuccess()">button</button>
<script>
function FunctionSuccess(){
Lobibox.notify('success', {
iconSource: 'fontAwesome',
size: 'mini',
delay: 8000,
sound: false,
title: 'Success!',
msg: 'Success message here.'
});
}
</script>
However, I would like to run a PHP file on the onClick event. My code to run the PHP file within the Javascript code is as follows:
<button id="buttonsuccess" class="btn btn-success" onClick="FunctionSuccess()">button</button>
<script>
function FunctionSuccess(){
$.ajax({
url: '/copy/test.php'
})
Lobibox.notify('success', {
iconSource: 'fontAwesome',
size: 'mini',
delay: 8000,
sound: false,
title: 'Success!',
msg: 'Success message here.'
});
}
</script>
But this doesn't work. I actually get the notification box message as I did before, but the PHP code does not run. Instead, I get the following error on console:
GET http://domain.com/copy/test.php 500 (Internal Server Error)
I just need to execute the code within the test.php file, I don't need to get data from it or post data to it, just execute the PHP file. BTW, I've tested the PHP file, it works fine.
error_log shows no errors, no PHP errors either. The permissions on the php file is also OK.
Much appreciate any insight you may be able to provide.
Thanks.