I'm trying to add a Laravel contact form to the front page of a website (no separate contact form page). I previoulsy integrated succesfully the HTML of a Divi theme wordpress layout to Laravel, after cloning it with Httrack.
My issue: The contact form does submit to mailtrap.io but only when I remove a javascript code from the homepage HTML code.
Here's the conflicting javascript code (rendered at the bottom of the HTML by Httrack) :
<script type='text/javascript'>
/* <![CDATA[ */
var DIVI = { "item_count": "%d Item", "items_count": "%d Items" };
var et_shortcodes_strings = { "previous": "Previous", "next": "Next" };
var et_pb_custom = { "ajaxurl": "1.23" };
var et_pb_box_shadow_elements = [];
/* ]]> */
</script>
I can't just get rid of the above javascript code or else it wipes out a section of the homepage.
The contact form (HTML from the Divi theme cloned HTML) looks like this:
@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@else
<form class="et_pb_contact_form clearfix form" method="POST">
{{ csrf_field() }}
<p class="et_pb_contact_field et_pb_contact_field_0 et_pb_contact_field_half" data-id="name" data-type="input">
<label for="name" class="et_pb_contact_form_label">Name</label>
<input type="text" id="name" class="input" value="" name="name" required data-required_mark="required" data-field_type="input" data-original_id="name" placeholder="Name">
</p>
<p class="et_pb_contact_field et_pb_contact_field_1 et_pb_contact_field_half et_pb_contact_field_last" data-id="email" data-type="email">
<label for="email" class="et_pb_contact_form_label">Email</label>
<input type="text" id="email" class="input" value="" name="email" required data-required_mark="required" data-field_type="email" data-original_id="email" placeholder="Email Address">
</p>
<p class="et_pb_contact_field et_pb_contact_field_2 et_pb_contact_field_last" data-id="service-9" data-type="input">
<label for="subject" class="et_pb_contact_form_label">Subject</label>
<input type="text" id="subject" class="input" value="" name="subject" required data-required_mark="required" data-field_type="input" data-original_id="service-9" placeholder="Subject">
</p>
<p class="et_pb_contact_field et_pb_contact_field_3 et_pb_contact_field_last" data-id="message" data-type="text">
<label for="message" class="et_pb_contact_form_label">Requests</label>
<textarea name="message" id="message" class="et_pb_contact_message input" required data-required_mark="required" data-field_type="text" data-original_id="message" placeholder="Requests"></textarea>
</p>
<div class="et_contact_bottom_container">
<button type="submit" name="et_builder_submit_button" class="et_pb_contact_submit et_pb_button" 4>Submit</button>
</div>
</form>
@endif
What needs to be done to stop the conflict?
Why does it work without the javascript code but doesn't work with it?
Thanks for you observations, greatly appreciated.
I've looked at fixes suggested here but they don't apply:
Send email from contact form in Laravel 5 using jQuery AJAX
JQUERY/ AJAX Request not going through and conflicts