JavaScript 问题 - 意外的令牌 (.


javascript issue - unexpected token (

这里的代码假设调用一个文件,该文件将返回用于填写表单的数据,但我收到此错误(在代码中),我不知道为什么。

dropdown.bind('change', function(){
    $post.('backgroundScript.php', 
Uncaught SyntaxError: Unexpected token ( - this is the error im getting
        { 
            first: dropdown.val() 
        },
        function(response) {
            $('#first').val(response.first);
            $('#last').val(response.last);
            // Repeat for all of your form fields
        },
        'json'
    );
});

如果你能帮我一把,我将不胜感激:)

把 . 在帖子之前而不是之后,感谢Mihai Stancu发现了这一点。

dropdown.bind('change', function(){
    $.post('backgroundScript.php', 
        { 
            first: dropdown.val() 
        },
        function(response) {
            $('#first').val(response.first);
            $('#last').val(response.last);
            // Repeat for all of your form fields
        },
        'json'
    );
});

尝试使用 "$.post( 而不是 $post.(