0

I have a form with submit button. following code is js code for this form: (note: I Know javascript Anonimous function but it is little bit diffrent types of form submit) Please explain how this Anonimous fucntion work

Post = form => {
            
                $.ajax({
                    type: 'POST',
                    url: form.action,
                    data: new FormData(form),
                    contentType: false,
                    processData: false,
                    success: function (res) {}
});

here, what is post = form => mean? what this kind of code is called in javascript?( Is it method or event call or anything else?)

I think this is anonymous functions in JS. but how does event is fire when I click on submit button.

Toha
  • 5
  • 3
  • "how does event is fire when I click on submit button" — Taking that literally: That's what submit buttons *do* (trigger submit events). If you mean "How does this function get called in response to a submit event?" then (all else being equal): It doesn't. The code to register it as an event listener isn't included in your question. – Quentin Mar 13 '23 at 09:52
  • Given there's no `let Post =` (or `var Post =`) this looks like it's part of a larger component/library/object - so how it's triggered on submit will be based on how the component listens for submit, then calls its own code with `Post` being an option in that component. – freedomn-m Mar 13 '23 at 10:43

0 Answers0