我得到一个“没有定义功能”的JavaScript错误与下面的代码,它使用jQuery的:错误的脚本W“没有定义功能”/jQuery的
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript">
function log_in() {
document.write('Logging in ... ');
$.post('process_ajax.php', { 'action' : 'log in' }, function(data) {
document.write(data);
create_new_story();
});
}
function create_new_story() {
document.write('Creating new story ... ');
$.post('process_ajax.php', { 'action' : 'create story' }, function(data) {
document.write(data);
});
}
</script>
</head>
<body onload="log_in()">
Processing...<br>
</body>
</html>
这里的PHP脚本,它调用(用于测试目的):
<?
die("Page opened.<br>");
?>
调用的第一个功能 - log_in() - 工作正常,但我得到这个错误:
“错误:create_new_story没有定义”
而且这个函数永远不会被执行。
我确定我缺少一些简单的东西。我能找到一双新的眼睛来找到它吗?