关于模态弹出的jquery ajax bootsrap

时间:2015-10-27 14:49:25

标签: jquery ajax twitter-bootstrap

当我点击类.btn-edit的按钮时,会出现模态,但是当我提交ajax请求后,如果我点击模态按钮,则模态不会显示。我需要刷新页面才能再次使用。

 $(".btn-edit").click(function(){
    $('#edit-profile').modal('show');
});


$(".update-form").submit(function(s){
    s.preventDefault();

    var website_name = $('input[name=website_name]').val();
    var website_url = $('input[name=website_url]').val();
    var type = $('#type option:selected').val();
    var category = $('#category option:selected').val();
    var sells = $('input[name=sells]').val();
    var location = $('input[name=location]').val();
    var payment = $('input[name=payment]').val();
    var description = $("textarea#message").val();

    $('#edit-profile').modal('hide');

    $.ajax({
        type: "POST",
        url: "advertiser/update",
        data: {
            _token: token, 
            website_name: website_name, 
            website_url: website_url, 
            type: type, 
            category: category, 
            sells: sells, 
            location: location, 
            payment: payment, 
            description: description
        },

        success: function(data) {
            $('.wrapper').html(data);
        }
        ,
        error: function(data) {

        }
    });

});

0 个答案:

没有答案