I'm trying to display a form action on same page. Right now it is redirecting to CGI output. How can I display output on the same page without moving away.
Below is the form configured in the page.
<h1>How fast is your connection?</h1>
<hr>
<FORM METHOD=get
ACTION="http://getmeip.net/cgi-bin/1.cgi">
Look for?
<input type=string name=ping>
<P>
<input type=submit value="ping this host">
</form>
</HTML>
Output is redirecting as shown in this picture. .
Either:
Edit the CGI program so it outputs the HTML for the form or
Use JavaScript with XMLHttpRequest or fetch to get the data instead of submitting the form and then update the DOM of the existing page with the response
Related
I am running a web server by Flask. I need python flask code to trigger submit button to be clicked on the HTML page. Then the page can "POST" data to the server. In the entire process, I should not click any buttons on the HTML page. Only thing I can do is to start the server at the very beginning. Does anyone know how to do that?
Thanks.
I know how to "POST" data from client-side. I only need to allow the server-side to trigger button at the beginning. I looked up the "RESPONSE" but can not figure out.
HTML:
<form action="" method="POST">
<label> Username </label>
<input type="text" id="trans" name="username" value={{request.form.username}}>
<button type=”submit”> Submit </button>
</form>
I currently have a web contain a recorder. I will play sound on my server and use iPhone and android phone to access the web to test the difference voice quality between devices. I need the server to trigger the button at the very beginning on multiple clients so they can start to record at the same time.
On the Flask server you need to have a function that receives the form once the submit button is clicked.
from flask import Flask
from flask import request
app = Flask(__name__)
#app.route('/handle_form>', methods = ['GET', 'POST', 'DELETE'])
def handle_form:
In the html you need to make sure the action of the form points to the url of /handle_form of the website :
<form action="{{ url_for('handle_form') }}" method="POST">
<label> Username </label>
<input type="text" id="trans" name="username">
<button type=”submit”> Submit </button>
</form>
The value of the input username cannot be obtained from the server before this form is submitted. I do not understand why you are trying to access the value of this form from server before submitting it.
I have a Jekyll site and a contact page on which I made a simple form and connected it with service like FormSpree or SimpleForm which automatically sends the responses to my inbox, what I would like to do is redirect to a Thank you for your response page after the form is submitted. Attempted this in many ways like adding event listener to the submit button or using onSubmit or action properties of the form but I was only able to achieve one of the two things, either the form submits or I am redirected to the Thank You Page, unable to perform both when I have no access to the server side script which I could have used for redirection. The form is pretty basic, a few input fields and a submit button. Would appreciate any form of help.
Both services allow a hidden field, in your form, which points to the thank you URL you want to be redirected after submission.
with FormSpree use _next (see advanced features)
<input type="hidden" name="_next" value="https://my-site.tld/thanks.html" />
with SimpleForm use redirect_to (see the sample code in their page)
<input type='hidden' name='redirect_to' value='https://my-site.tld/thanks.html' />
I'm messing with testing XSS using a simple html form that redirects to an insecure page with a login form (PHP server side). I'm trying to get an alert to popup on the page with the login information of the user once they hit the 'login' button. However, even after something simple like this on this initial page the redirects:
<body onload="document.forms[0].submit()">
<form action="localhost:8000/testpage.php" onsubmit="" method="POST">
<input type="hidden" name="test" value="><script>alert(1)</script>">
</form>
</body>
I cannot get anything to appear successfully.
I want to make chat program. But when I click submit http is
reset "localhost:3000/" to "localhost:3000/?"
Why http reset and append address ?
if i don't use server just run index.html also
file:///C:/Users/dude/Desktop/node/index.html?
this is index.html code
<html>
<head>
<title> chat with node js socket io </title>
<style>
#chat{
height:500px;
}
</style>
</head>
<body>
<div id="chat"></div>
<form id="send-message">
<input size="35" id="message"></input>
<input type="submit"></input>
</form>
</body>
</html>
I think you need to be a bit clearer on your information here.
Are you sure you want to submit the whole page? I think what you are looking for is not posting the information with the whole page, which is what the form and submit will be doing.
If you use AJAX, you will only be sending the information you need, not the whole page, and update accordingly.
The "?" is part of the querystring, and should not affect the workings of your sofware. It is hinting that it is trying to do a "GET" with the form, which is the default behaviour. Do you have anything listening for the "GET" on the server?
I suggest to follow the standard HTML conventions in forms, by adding name attributes to your inputs, a URL where your form should be posting to ("action" attribute). Once you have standardized your HMTL, the next step would be to look at your functionality requirements. E.g. do you have your server functionality in place, where the chat info will be sent to?
I have a page with a regular form:
<form method="post" action="pro.asp">
<input type="text">
<input type="submit">
</form>
when it gets to the pro.asp page it will do some server side actions like sending mail and then I need that page to send all the parameters in the post request to another website
I don't want to have another form filled auto and auto submit with javascript script
Is there a solution for that?
Do you have to make a POST to the other website?
The simplest thing to do may be to, when you are finished your own form processing, send the values to the other page as a GET.
To do that all you would need to do is end your processing with a response.redirect.
Response.Redirect ("http://somewebsite.com?value=X")