Answer the question
In order to leave comments, you need to log in
How to return response after successful completion of ajax function to script?
hello there is a form
<form method="POST" id="cnw" action="javascript:void(null);" onsubmit="call()">
<div class="form-group">
<label>1</label>
<input type="text" name="1" class="form-control" maxlength="20" placeholder="1">
</div>
<div class="form-group">
<label>2</label>
<input type="text" name="2" class="form-control" placeholder="2">
</div>
<div class="form-group">
<label>3</label>
<textarea class="form-control" name="3" rows="3" maxlength="63" placeholder="3" style="margin: 0px -0.5px 0px 0px; height: 98px; width: 487,5px;"></textarea>
</div>
<button type="submit" class="btn btn-default">Отправить</button>
</form>
function call() {
var msg = $('#cnw').serialize();
$.ajax({
type: 'POST',
url: 'mcnews',
data: msg,
success: function(data) {
aler('Окей')
},
error: function(xhr, str){
alert('Возникла ошибка: ');
}
});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question