简体   繁体   中英

build a script to grab data from HTML Form and place it on

I have a short script that pulls information from a site called RPR. I was wondering if I can build a page that contains an html form with an input field called "Address" and when the form is submitted it fills out the "Query" line automatically on the next page?

<script type="text/javascript">
var rprAvmWidgetOptions =
{
Token : "0596733F-54FC-4C23-89C8-8B021A6E486C",
Query : "278 S 23rd St, Philadelphia, PA 19103",
CoBrandCode : "btsusspaces",
ShowRprLinks : true
} 
</script>   

<script type="text/javascript" src="//www.narrpr.com/widgets/avm-widget/widget.ashx/script"></script>         

When you submit the form, your Address will be sent via POST or GET.

You can add it to a hidden input :

<input type="hidden" id="my_address_post" value="<?php echo $_POST['Address']; ?>">

Then in your javascript you simply get the value of the input in a variable and write the variable name in your "Query" :)

var my_address = document.getElementById('my_address_post').value;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM