这里的代码假设调用一个文件,该文件将返回用于填写表单的数据,但我收到此错误(在代码中),我不知道为什么。
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'
);
});
关于php - JavaScript 问题 - 意外的标记(,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11840288/