I use Laravel 5.5 and PHP 7, and I'm creating a form like this.
<form id="form" name="xxx" action="post">
<input type="text" name="body_color[1][en]">
<button type="submit" name="submit">Submit</button>
</form>
I post data via Ajax, and I receive the following response from Laravel when I have an error.
error: body_color.1.en: ["The body color.1.en field is required."] success: false
If Laravel doesn't replace "[" and "]" with a dot, I can show an error message on the browser efficiently using jQuery.
$('#form *[name=body_color[1][en]]').after('input error!');
How can I show a simple error message in the web browser?