SyntaxError:缺少;before语句使用AJAX
SyntaxError: missing ; before statement with AJAX
我在执行ajax请求时遇到了这个错误,如果我根本找不到问题,我会仔细查看。这是下面的代码。
$('#post_submit').click(function() {
var poster_id = <?php echo $session_user_id; ?>;
//firebug syntax error shows the line below is the problem
var profile_user_id: <?php echo $user_id; ?>;
var post = $('#post').val();
$.post('ajax_submit_post.php',
{
profile_user_id: profile_user_id,
poster_id: poster_id,
comment_type : comment_type,
post: post
},
function () {
$('#status').append('<li class="hide">Posted</li>').hide(1000);
});
});
我想你是想用等号吗?
var profile_user_id = <?php echo $user_id; ?>;
而不是
var profile_user_id: <?php echo $user_id; ?>;
相关文章:
- SyntaxError:缺少;before语句使用AJAX
- ReactJS:在带有 ajax 调用的 .map() 语句完成后执行代码
- 如何使用for循环语句通过Ajax发送大数据数组
- PHP INSERT Prepared语句未使用ajax插入
- Javascript AJAX PHP if语句不起作用
- Ajax 调用忽略我的 if 语句
- 如何从 jQuery.ajax 成功语句推送父对象
- if 和 else-if 语句拒绝在 jQuery 的 AJAX 函数中工作
- 如何在 ajax jquery 中编写成功语句以更改单选按钮
- if 语句在 javascript/ajax 中不起作用
- ajax if 语句无法正常工作
- Ajax 请求在没有警报语句的情况下不起作用
- Return语句在ajax调用之前调用
- 如何在JQueryWhen-Then语句中循环Ajax请求
- 使用带有IF语句的jQuery ajax响应
- 发送ajax请求时出现return语句问题
- ajax附加块中的if语句
- 访问$.ajax语句中分配的JSON时出现问题
- Ajax if 语句请求
- 转换要在Ajax语句中读取的coldfusion变量