0

Hello I have this error I cannot find why is giving me. any ideas how to fix this? thank you all!

form.html:34 Uncaught ReferenceError: send is not defined at HTMLInputElement.onclick (form.html:34) onclick @ form.html:34

<script type="text/javascript" src="jquery-3.6.0.min.js">;
    function validate_mail(mail) {
        var filter = /[\w-\.]{1,}@([\w-]{1,}\.)*([\w-]{1,}\.)[\w-]{2,4}/;
        return filter.test(mail)
    }

function send() {
    if (validate_mail($("#email").val())) {
        data = {
            'name': $("#name").val(),
            'email': $("#email").val(),
            'phone': $("#phone").val(),
            'cellphone': $("#cellphone").val(),
            'message': $("#message").val()
        };
        jqxhr = $.ajax({
                'url': "./sendContact.php",
                'type': "POST",
                'data': data
            })
            .done(function() {
                $("#landingForm").html("<span>Success</span>");
            });
    }
} 
</script>
<div id="landingForm">
    <div class="titulo2">CONTACTO</div>
  <div><label>Name:</label><input type="text" id="name"/></div>
  <div><label>Phone:</label><input type="text" id="phone"/></div>
  <div><label>Cellphone:</label><input type="text" id="cellphone"/></div>
  <div><label>Email:</label><input type="text" id="email"/></div>
    <div><label>Message:</label><textarea id="message"></textarea></div>
    <input type="button" onclick="send()" value="SEND"></div>
</div>
  • You cannot specify a `src` attribute and content in the ` – miken32 Jul 15 '21 at 21:53
  • You should also be adding the click handler in your JS code, not in an `onclick` attribute, which is a very outdated habit. Same for `type` attribute in ` – miken32 Jul 15 '21 at 21:54

0 Answers0