I need your help on my simple script. I want when user click on image (with id="menu_en") to execute external script in php page (in my case english.php), but ajax call is not working. Even using "error:" statement "alert(xhr.status);" does not help me as alert is showing just "0" and hide in second... Where I'm wrong? Here is my code placed into the body of the page:
<script src='jquery-1.11.3.min.js'></script>
<script>
$(document).ready(function(){
$('#menu_en').on('click',function(){
var enID = '1';
var url = 'index.php';
$.ajax({
type:'POST',
dataType: 'JSON',
url:'english.php',
data: {language_id: enID},
success:function(data){
alert('Success!');
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
}
});
});
});
</script>