Home > OS >  Why form redirects and not only "process" data?
Why form redirects and not only "process" data?

Time:07-31

There is a form here. Earlier I always used axios, anyway. So a POST is sent to https://api.skymongoose.com/subscription after subscribe button is pressed.

But why it redirects to a blank website? Url points to https://api.skymongoose.com/subscription.

<section className="section-base align-center section-color">
                <div className="container">
                    <h2>Feliratkozom most</h2>
                    <div className="width-650">
                        <p>Kíváncsi vagyok mi történik felétek</p>
                        <hr className="space-sm" />
                        <form
                            action="https://api.skymongoose.com/subscription"
                            className="form-box form-ajax form-inline align-center"
                            method="post"
                            data-email="[email protected]"
                        >
                            <div className="row">
                                <div className="col-lg-4"></div>

CodePudding user response:

If you don’t override it using JavaScript, submitting the form will bundle the data in the form into an HTTP request, send that request to the url in the action and navigate to the result (rendering it in the viewport) much like a link (with a more complicated request).

If https://api.skymongoose.com/subscription doesn’t display anything useful then it probably isn’t designed to be accessed with a regular form submission.

  • Related