danjapro Posted September 25, 2014 Share Posted September 25, 2014 We are getting back each error message, but it only outputs the last error message. how can we append each error message to the DIV Here is the code that loops thru each error message if(data.length > 0) { $.each(data, function(error_code, message ) { if(errorCode == $.trim(message.error_code) && errorCode != -1 ){ error_message = message.message; return false; } }); } Here is the code that outputs the error message in a drop down. PLEASE ANY HELP if(BoltNotify === true && multipleNotice === true){ //var error_message += error_message; var spanerrorgen = $('.error.message').contents().find('h4').html(error_message); var appenderrorgen = $('.error.message').contents().find('h4'); $.each(data, function($fieldref) { $(spanerrorgen).append(spanerrorgen); }); VanillaReload.notify.showNotification(".error"); } Quote Link to comment https://forums.phpfreaks.com/topic/291281-how-to-append-each-error-message/ Share on other sites More sharing options...
CroNiX Posted September 25, 2014 Share Posted September 25, 2014 Because you are just replacing the old error message with the new one, so it will only show the last one. Try appending the message... error_message += message.message; Quote Link to comment https://forums.phpfreaks.com/topic/291281-how-to-append-each-error-message/#findComment-1492066 Share on other sites More sharing options...
CroNiX Posted September 25, 2014 Share Posted September 25, 2014 Or if error_message is supposed to be an array, append it. error_message.push(message.message); Quote Link to comment https://forums.phpfreaks.com/topic/291281-how-to-append-each-error-message/#findComment-1492067 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.