jQuery.post() not working in chrome but works in FF
I am using jQuery.post()
to post data to a processing page which returns a result and the jQuery code react on this result, either adding a success message or failure message depending on the result. However it isnt working开发者_如何学编程 in chrome. In firefox it adds the info to the database(which is what the process page does) and then runs the success message. but in chrome it does nothing. when i try to refresh in chrome it says the form has been submitted and gives the resending data warning. But the jquery code is supposed to prevent the form being submitted via normal means.
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;
});
Does anyone know why chrome isnt using the jQuery properly?
Add a semicolon before return false
精彩评论