Why alert("Test1") is executed, while alert("Test2") is not executed?
P.S. Currently I'm not using json data.
<script>
$(document).ready(function() {
var param = 10;
$.getJSON(
'modules/mod_scheduler/updateList.php?param'+param,
function(data)
{
alert("Test1");
find_optimal_schedule();
}
);
});
</script>
<script language="javascript">
function find_optimal_schedule() {
alert("Test2");
//...
}
</script>
find_optimal_schedule()function. If there is a syntax error in the part you don't show it would stop the function from running and thus not alert "Test2".//...represented more code. But if that's the whole function and the whole of that script block I don't see any reason why it wouldn't work.