0

i have this form that sends some info and a picture in it but when i submit it it did not do anything and fails with "[HTTP/1.1 304 Not Modified 1ms]"

I have another form that do exactly the same but in other page and it works.

This is the form tag

<form class="form-horizontal" method="post" id="form-insArtist" enctype="multipart/form-data">

And this is the js where i was trying to do some test...

$('#form-insArtist').on("submit", function(event){
    event.preventDefault();
    alert("Yes"); // It not even show this alert
    /*$.ajax({
        beforeSend: function () {
            $.validator.setDefaults({
                submitHandler: function () {
                    document.getElementById("overlay-insartist").innerHTML = "<div class='overlay d-flex justify-content-center align-items-center'><i class='fas fa-2x fa-sync fa-spin'></i></div>";
                }
            });
            $('#form-insArtist').validate({
                rules: {
                    txtartistname: {
                        required: true
                    },
                    txtcountry: {
                        required: true
                    },
                    txtmail: {
                        required: true,
                        email: true
                    },
                    txtphone: {
                        number: true
                    },
                    txtcel: {
                        number: true
                    }
                },
                messages: {
                    txtartistname: {
                        required: "Insert artist name.",
                    },
                    txtcountry: {
                        required: "Insert artist country.",
                    },
                    txtmail: {
                        required: "Insert artist mail.",
                        number: "Insert a valid mail."
                    },
                    txtphone: {
                        number: "Insert valid phone number (ex. 0000 0000)"
                    },
                    txtcel: {
                        number: "Insert valid cel number (ex. 0000 0000)",
                    },
                },
                errorElement: 'span',
                errorPlacement: function (error, element) {
                    error.addClass('invalid-feedback');
                    element.closest('.form-group').append(error);
                },
                highlight: function (element, errorClass, validClass) {
                    $(element).addClass('is-invalid');
                },
                unhighlight: function (element, errorClass, validClass) {
                    $(element).removeClass('is-invalid');
                }
            });
        },
        type: 'POST',
        url: '../assets/php/insert/artist.php',
        data: new FormData(this),
        cache: false,
        contentType: false,
        processData: false,
        success: function (response) {
            //alert(response);
            $('#modal-insartist').modal('hide');
            toastr.success('Correct.');
            $("#gallery-artist").load(" #gallery-artist");
        },
        error: function (response) {
            toastr.danger('Uh oh, it might fail.');
        },
        complete:function(){
            document.getElementById("overlay-insartist").innerHTML = '<div></div>';
        }
    });*/
});

I try deleting all cache and history, i try to change the way how is submitted the form and still show this error "304 Not Modified" what else can do?

1 Answers1

0

Please correct the ID spellings because in HTML your id is id=form-insArtist

While in Js file your id is #form-insArtista'

'a' is missing

Javaid
  • 320
  • 2
  • 9
  • Oh, you're right, I'm sorry I copied it bad. Thanks for that. I alreaey edit my question, this was not the problem, I can't still do any event submiting the form. – Lina Gonza Nov 16 '22 at 08:14