Failed to display a message in a div but shown in console

Hello I have a page where I can add an organisation. But I dont want to add org with the same name ofc so I have some validation. Now the problem is, it doesnt show the message in the error div i created. It does get logged fine in the console though.
Adding new organization with data: {"_csrf":"p2isoXX1pMa5t7G2RKgxPUOgkYkIBkobZKGNt10RdxJiOwZyn13KkkyWkqCUgoWCJYUFDSKTvLBpNSs2XJK81G4pQnRWWjIQ","${_csrf.parameterName}":"${_csrf.token}","organisationName":"Aman","username":"gertzsfrf","password":"hello@1234"}
api/organisations:1


Failed to load resource: the server responded with a status of 400 ()
organizations.js:106 Alert: Failed to add Organization. The organisation with this name already exists! Type: danger
organizations.js:44 Failed to add Organization: The organisation with this name already exists!
Adding new organization with data: {"_csrf":"p2isoXX1pMa5t7G2RKgxPUOgkYkIBkobZKGNt10RdxJiOwZyn13KkkyWkqCUgoWCJYUFDSKTvLBpNSs2XJK81G4pQnRWWjIQ","${_csrf.parameterName}":"${_csrf.token}","organisationName":"Aman","username":"gertzsfrf","password":"hello@1234"}
api/organisations:1


Failed to load resource: the server responded with a status of 400 ()
organizations.js:106 Alert: Failed to add Organization. The organisation with this name already exists! Type: danger
organizations.js:44 Failed to add Organization: The organisation with this name already exists!
here is the codepen with the html and js https://codepen.io/Aman-sghh/pen/GRbpKKz
No description
3 Replies
Aman
AmanOP5mo ago
and whats interesting is that same logic works on a different page
MarkBoots
MarkBoots5mo ago
bit hard to trouble shoot without working code. but in your showAlert function you are selecting an element with it id alert-container. I can not see that element on your page
Aman
AmanOP5mo ago
Yeah that was issue😁 . I thought I had added but it was only in the js code. Silly mistake
Want results from more Discord servers?
Add your server