【发布时间】:2011-05-04 20:44:29
【问题描述】:
我正在使用jQuery.post() 将数据发布到返回结果的处理页面,jQuery 代码对此结果做出反应,根据结果添加成功消息或失败消息。但是它不适用于chrome。在 Firefox 中,它将信息添加到数据库(这是流程页面所做的),然后运行成功消息。但在 chrome 中它什么也不做。当我尝试在 chrome 中刷新时,它说表单已提交并给出重新发送数据警告。但是 jquery 代码应该阻止通过正常方式提交的表单。
var $j = jQuery.noConflict();
$j(document).ready(function()
{
$j('body').delegate('#submit_form_qr','submit',function(event){
event.preventDefault();
$j("#process_info").removeClass().addClass('loading').html("Loading...").fadeIn("slow");
$j.post('<?php echo $config['asf_root']; ?>/modules/quick_reply_process.php',{
quick_reply:$j('#quick_reply_ta').val(),
user_name :'<?php echo $template->user_name; ?>',
quoting: '<?php echo $template->original_poster; ?>',
subject: '<?php echo $template->post_subject; ?>',
forum_id: '<?php echo $template->forum_id; ?>',
topic_id: '<?php echo $template->topic_id; ?>'
}, function(data)
{
if(data != 0)
{
jQuery("#process_info").removeClass().addClass('subject_okay').html("Replied Successfully!").fadeIn("slow");
}
else
{
jQuery("#process_info").removeClass().addClass('subject_error').html(data).fadeIn("slow");
}
})
return false;
});
有人知道为什么 chrome 不能正确使用 jQuery 吗?
【问题讨论】:
-
如果按
Ctrl+Shift+J,chrome会显示错误吗? -
从不知道该功能(我是 chrome 新手)。它提出了错误: Uncaught SyntaxError: Unexpected token ( at this line: $j.('#submit_btn').colorbox({width:'450px', height:'250px'}); asf_is_absolutely_awesome-ex:768Uncaught SyntaxError:意外的令牌(});编辑:我现在已经修复了:该错误行在 $j 之后有一个句点,它不应该有。感谢您的帮助。不知道为什么 FF 和 firebug 从未显示任何错误。
标签: jquery google-chrome firefox