开发者

jquery ajax sumit without page refresh problem

开发者 https://www.devze.com 2023-02-06 13:09 出处:网络
I need a ajax submission system without page refresh, I found one from the submit-a-form-without-page-refresh-using-jqueryscript site

I need a ajax submission system without page refresh, I found one from the submit-a-form-without-page-refresh-using-jquery script site

After a little modify, remove jquery-ajax\images\form_bg.png, How to do submit the data many times? I mean when submit first time, then I empty the text box, how to write another message then submit again? And another problem: when I submit once, it appears Submitted! success. one time. I submit twice, it appears Submitted! success. two times. I submit third times, it appear开发者_JAVA技巧s Submitted! success. third times. How to solve it? Thanks.

success: function() {
$('#contact_form').append("<div id='message'></div>");
$('#message').append("<h2>Submitted!</h2>")
.append("<p>success.</p>")
.hide()
.fadeIn(1500, function() {
$('#message').append("<img id='checkmark' src='check.png' />");
})
.fadeOut(3000, function() {
$('#message').css('display','none');
});
$('#name').val('');
$('#message').val('');
}


In your submit function return false; as the last statement.

success: function() {
    $('#contact_form').append("<div id='message'></div>");
    $('#message').html("<h2>Submitted!</h2>")
            .append("<p>success.</p>")
            .hide()
            .fadeIn(1500, function() {
        $('#message').append("<img id='checkmark' src='check.png' />");
    })
            .fadeOut(3000, function() {
        $('#message').css('display', 'none');
    });
    $('#name').val('');
    $('#message').val('');
}

su

0

精彩评论

暂无评论...
验证码 换一张
取 消