When performing user login, if the login succeeds, I would like to display a message in a certain div. However, if the login fails, another message is displayed in another div. Is it possible to determine the content of Ajax’s ‘returnData’ and update the appropriate div accordingly? For example:
$(document).ready(function() {
$('.submitForm').ajaxForm({
success: function(returnData) {
if (returnData == '...') { // (or: len(returnData) == ... whatever)
$('#someDiv').html(returnData);
} else {
$('#otherDiv').html(returnData);
}
}
});
});
Yes, it is certainly possible to do that. You’re using the pseudocode:
But what it actually would be is not far off: