0
Good afternoon Amigos!
I have a problem receiving a URL with the POST method.
I make a request ajax as below:
$('#ajaxButton').on('click', function () {
const data = document.referrer.toString();
$.ajax({
url: "/negociar-valores.aspx",
data: data,
type: "POST",
success: (data) => {
console.log("deu bom:" + data);
window.location.href = "/negociar-valores.aspx";
},
error: (data) => {
console.log("deu ruim:" + data);
}
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<div id="ajaxButton">NEGOCIAR VALORES</div>
The "date" constant with the Document.referrer.toString() method has the following value: "http://localhost:46729/quote-results/? destination=194&period=17-08-2019%2C22-08-2019&age=20&age=&age=&age=&age="
But on the.aspx trading-value page, when I request the url value:
NameValueCollection coll;
coll=Request.Form;
System.Diagnostics.Debug.WriteLine(coll.ToString());
Instead of receiving the url as I described above, I get it this way:
"http%3a%2f%2flockeost%3a46729%2fcotacao-resultados%2f%3fdestino=194&periodo=17-08-2019%2c22-08-2019&idade=20&idade=&idade=&idade=&idade=&idade="
My question is as follows; is there any way to convert this received value to the correct url? replacing these "%3a" with ":" and "%2f" with "/" so I can use this data?
Thank you in advance!
Thank you very much! it worked!
– MSHijo