Answer the question
In order to leave comments, you need to log in
How to get confirmation message in modal window?
Created a form in a modal window / Drupal 7, Webform, Colorbox, Colorbox Node, Webform Ajax/
When you click on the link, the window opens as it should.
And when submitting the form, a full page with the same form opens.
The message is not shown.
Answer the question
In order to leave comments, you need to log in
If after sending the handicap, on the new page you don’t have the necessary text in the pop-up window, then you have a problem on the server side, if you need something that would just work without reloading, then wrap the form in a div with some ID like this:
<div id="callback">
<form ....>
.....
</form>
</div>
$(function() {
function ajaxForm(BlockID) {
if ($('#' + BlockID + ' form:first').length > 0) {
$(document).on('submit', '#' + BlockID + ' form:first', function () {
var data = $(this).serialize();
$.ajax({
data: data,
type: "post",
url: document.location.href,
success: function (answer) {
var start = answer.indexOf('<body');
var end = answer.indexOf('</body>')+7;
answer = answer.substring(start, end);
answer = $(answer).find('#' + BlockID).html();
$('#' + BlockID).html(answer);
}
});
return false;
})
}
}
ajaxForm('callback');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question