0

I need to basically forward post variables get the response and feed it back to an ajax post.

Essentially : I have an ajax post that needs to post to an ASP file. This file needs to forward these post variables to a PHP file and await a response. The ASP file should then receive a response and relay that to the callback on the original ajax post.

I can write this quite quickly in PHP but am hoping for an ASP classic alternative as it is on a windows server with no PHP support.

Thanks in advance.

ByronVerreyne
  • 85
  • 2
  • 6
  • Possible duplicate of [ASP equivalent of Curl (not ASP.NET)](http://stackoverflow.com/questions/381596/asp-equivalent-of-curl-not-asp-net), found using [this search](https://duckduckgo.com/?q=classic+asp+curl). – halfer Jan 29 '14 at 13:17
  • Thanks halfer. Thanks for this. How would I then add post variables to the code or print the results on the page? – ByronVerreyne Jan 29 '14 at 13:22
  • I would guess `xhr.send myData` from one of those answers. Why not give it a go? – halfer Jan 29 '14 at 13:31
  • I your server http request object is called objRequest, then you could print it with `Response.Write objRequest.ResponseText` – John Jan 29 '14 at 14:20
  • Here's a link to an example with form variables http://www.developerfusion.com/article/3272/posting-form-data-to-a-web-page/2/ – John Jan 29 '14 at 14:26
  • Thanks guys. Attempting now. – ByronVerreyne Jan 29 '14 at 14:40
  • Hi Guys. This ended up working for me. thanks for your help! <% set XmlObj = Server.CreateObject("Microsoft.XMLHTTP") XmlObj.open "POST", "http://comain.co.za?var1=" & request.form("var1") & "&firstname=" & request.form("firstname") & "&action=" & request.form("action") , false XmlObj.send formatdata = XmlObj.responseText Response.write(formatdata) Set XmlObj = nothing %> – ByronVerreyne Jan 30 '14 at 09:46

1 Answers1

0

This ended up working for me. thanks for your help!

<% 
set XmlObj = Server.CreateObject("Microsoft.XMLHTTP") 
XmlObj.open "POST", "domain.co.za?var1="; & request.form("var1") & "&firstname=" & request.form("firstname") & "&action=" & request.form("action") , false 
XmlObj.send formatdata = XmlObj.responseText 
Response.write(formatdata) 
Set XmlObj = nothing 
%>
ByronVerreyne
  • 85
  • 2
  • 6