PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, September 8, 2022

[FIXED] Why form redirects and not only "process" data?

 September 08, 2022     ajax, axios, forms, html, javascript     No comments   

Issue

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="example@domain.com"
                        >
                            <div className="row">
                                <div className="col-lg-4"></div>

Solution

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.



Answered By - Quentin
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing