У меня есть такой сценарий:
$('form').each(function validate() { // attach to all form elements on page
$(this).bootstrapValidator({
// initialize plugin on each form
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: ''
},
live: 'enabled',
trigger: null,
fields: {
ServiceCategory: {
validators: {
notEmpty: {message: "<?php echo $Missing_Service_Category ?>"},
regexp: {regexp: /^[A-Za-z]/, message: "<?php echo $Wrong_Service_Category ?>"},
}
},
}
})
.on('success.form.bv', function(e, data) {
// Prevent form submission
e.preventDefault();
// Get the form instance
var $form = $(e.target);
// Get the BootstrapValidator instance
var bv = $form.data('bootstrapValidator');
// Use Ajax to submit form data
// Use Ajax to submit form data
$.ajax({
url: $form.attr('action'),
type: 'POST',
contentType: "application/x-www-form-urlencoded;charset=utf-8",
data: $form.serialize(),
success: function(data){
var parts = data.split('|')
var type = parts[0]
var text = parts[1]
if (type==1){
// If Success type is 1, show success message with type success
$('.top-right').notify({
message: { text: text },
type: 'info',
}).show();
$(".tab-content").load(" .tab-content > *", $(document).ready(function() {
$.ajax({
url: 'scripts.php',
success: function(data) {
$("#scripts").html(data);
}
});
}));
}
else if (type==2){
// If Success type is 1, show success message with type success
$('.top-right').notify({
message: { text: text },
type: 'danger',
}).show();
}
else if (type==3){
// If Success type is 3, print messaage to #ResponseDIV
$('#ResponseDiv').html(text);
}else{
// If Success type is 3, print messaage to #ResponseDIV
$('#ResponseDiv').html(text);
}
},
error: function(xhr){
// If Success type is 1, show success message with type success
$('.top-right').notify({
message: { text: xhr.status + " " + xhr.statusText },
type: 'danger',
}).show();
},
});
})
});
После того, как это будет сделано, новый div будет загружен с фактическими данными.
Внутри div есть форма, но после
$(".tab-content").load(" .tab-content > *",
отправка форм больше не работает. Когда я обновляю всю страницу, все работает нормально.
Есть ли какое-либо решение для загрузки () div и снова заставить кнопку отправки в форме работать?
Есть много вложенных запросов Ajax ... ajax(), .load() ... лол! и обработчик .ready() посередине. Я думаю, вам нужно прочитать об ajax и его характеристиках.

Я сделал отступ в вашем коде, чтобы его можно было прочитать ... Это был беспорядок. Вы пользуетесь редактором?