HTTP Response Status Code
I have a form to create new user in my MySQL database. I'm using fetch API to send the form data to a PHP script without reloading the page. The script will do the task using the form data. If something goes wrong in the script (e.g. user is not created due to backend form validation failure) I want to change the response status code. Is it okay to do so? If yes which response status code should I use? Is there any better way to do the same? I just need to know if the user account has been created or not. Based on this I will show alert message.