Ich habe einen ajax
Aufruf wiejQuery: Ajax beide Handler läuft - fertig und scheitern
$.ajax({
type: 'POST',
url: 'addVideo',
data: {
video_title: title,
playlist_name: playlist,
url: id
// csrfmiddlewaretoken: '{{ csrf_token }}',
},
done: bootstrap_alert.success('video saved successfully'),
fail: bootstrap_alert.error('There were some errors while saving the video. Please try in a while')
});
und Aktionen wie
// setting up alerts on action
bootstrap_alert = function() {}
bootstrap_alert.success = function(message) {
$('#feature').prepend('<div class="alert alert-success"><a class="close" data-dismiss="alert">×</a><span>'+message+'</span></div>');
}
bootstrap_alert.error = function(message) {
$('#feature').prepend('<div class="alert alert-error"><a class="close" data-dismiss="alert">×</a><span>'+message+'</span></div>');
}
Wenn das vordere Ende Ajax-Aufruf macht, ich sehe beide Mitteilungen an die gleiche Zeit
video saved successfully
There were some errors while saving the video. Please try in a while
Ist das nicht ich mache den Ajax-Aufruf richtig?
UPDATE
done
-success
Ergebnisse in demselben Verhalten zu ändern
// send the data to the server using .ajax() or .post()
$.ajax({
type: 'POST',
url: 'addVideo',
data: {
video_title: title,
playlist_name: playlist,
url: id
// csrfmiddlewaretoken: '{{ csrf_token }}',
},
success: bootstrap_alert.success('video saved successfully'),
fail: bootstrap_alert.error('There were some errors while saving the video. Please try in a while')
});
Die Serverantwort ist HTTP/1.0" 200 3200
, glaube ich, die fail
nicht
Sind Sie sicher, '$ ('# feature')' wird nicht von einem anderen Teil Ihres Codes geändert? –
Ja, es ist nicht geändert – fullstackcrash