Answer the question
In order to leave comments, you need to log in
Error in jQuery code, can you help?
Toasters, hello)
In general, I have a site written in oop.
There is a button "Output" and when pressed, it should write to the database and display a window with a message.
All windows and everything is there, but when you click an error:
The code itself:
$(document).ready(function() {
$('form').submit(function(event) {
if ($(this).attr('id') == 'no_ajax') {
return;
}
var json;
event.preventDefault();
$.ajax({
type: $(this).attr('method'),
url: $(this).attr('action'),
data: new FormData(this),
contentType: false,
cache: false,
processData: false,
success: function(result) {
json = jQuery.parseJSON(result);
if (json.url) {
window.location.href = '/' + json.url;
} else {
alert(json.status + ' - ' + json.message);
}
},
});
});
});
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