Answer the question
In order to leave comments, you need to log in
Why doesn't preventDefault() work in Safari?
Hello! The code below works in Chome, Yandex Browser, but not in Safari.
$('#form_setting').click(function(e) {
var data = $('#player_setting');
$.ajax({
type: data.attr('method'),
url: data.attr('action'),
data: data.serialize(),
success:function(data) {
}
});
})
e.preventDefault();
works in Safari, but I need the action to be performed, i.e. as in above code withoute.preventDefault();
$('#form_setting').click(function(e) {
e.preventDefault();
var data = $('#player_setting');
$.ajax({
type: data.attr('method'),
url: data.attr('action'),
data: data.serialize(),
success:function(data) {
}
});
})
Answer the question
In order to leave comments, you need to log in
$('#form_setting').click(function(e){
var data = $('#player_setting');
$.ajax({
type: data.attr('method'),
url: data.attr('action'),
data: data.serialize(),
success:function(data) {
$('#setting').submit();
}
})
})
form="form_setting"
<button type="submit" name="submit" id="form_setting">Сохранить</button>
<input type="hidden" name="form_setting" value="1">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question