The following code is in my view/tmpl/edit.php:
<script type="text/javascript">
jQuery("#button").click(function(){
jQuery.ajax({
url:'somefile.php',
type:'POST',
data: {action:"1"},
success: function(response) {alert(response);}
});
});
</script>
and in the same folder i have the somefile.php with the following code:
if (isset($_POST['action'])) {
SomeFunction();
}
function SomeFunction()
{
...do something
}
My problem is that when I hit the button it never access the somefile.php although the script is executed (checked with alerts). What am I doing wrong here?
Please show me some directions on that with some relevant sample/example code.
Thanks.