Search code examples
htmlform-submitcontactscontact-form

Can I stop this redirect? formsubmit.co


I just noticed about Formsubmit.co Also it is a great service! my problem is, in my email field if someone enters something like email@email with that .com it takes it to another page. Where it says to enter a valid email. I don't want something like this... How can I disable it? Or is it possible to redirect it to any page in my domain? like mydomain.com/error.html?

Or is it possible to show errors in my page? Like with AJAX? or something like that? I have no experience with it. Can someone help me with it? I want everything under my domain . lol

Visit my website for live details:- suki.is-a.dev (In the sign up email feild, enter something without a tld eg. blablabla@blablabla)


Solution

  • You can do it with JQuery by adding a click listener to your submit button that triggers an AJAX call to formsubmit.co. Just replace the content in the data JSON of the ajax call with your form data:

    $(yourButtonSelector).click(function() {
     $.ajax({
        method: 'POST',
        url: 'https://formsubmit.co/ajax/[email protected]',
        dataType: 'json',
        accepts: 'application/json',
        data: {
            name: "insert name from form here",
            message: "insert message from form here"
        },
        success: (data) => console.log(data),
        error: (err) => console.log(err)
     });
    });
    

    Click here for more information about AJAX calls to formsubmit.co: https://formsubmit.co/ajax-documentation

    If you add the code of your form to your question I can adjust my example to your case