Avatar of Whing Dela Cruz
Whing Dela CruzFlag for Anguilla

asked on 

Sending ASP to server side

Hi experts, I just want to know and learn if i could send to asp server side without using form? My codes below trying to send asp server side directly without any data from form or input text. If this is not possible please help me understand. Thank you!

<!Doctype Html>
<Html>
<Body>
<button onclick="Go()">Submit Serverside</button>
</Body>
<script>
function Go()
{
  var r = "Send to MyAsp.asp"
  send r to MyAsp.asp server side
}
</script>
<Html>
ASPHTMLJavaScript

Avatar of undefined
Last Comment
Whing Dela Cruz
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

The answer is yes.

However, you need a page such as MyAsp.asp to accept the data.

https://support.microsoft.com/en-us/help/290591/how-to-submit-form-data-by-using-xmlhttp-or-serverxmlhttp-object

Consider code below
<%
DataToSend = "id=1"
dim xmlhttp 
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST","http://mysite.com/MyAsp.asp",false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send DataToSend
Response.ContentType = "text/xml"
Response.Write xmlhttp.responsexml.xml
        Set xmlhttp = nothing
%>

Open in new window

SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Brian Tao
Brian Tao
Flag of Taiwan, Province of China image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Whing Dela Cruz

ASKER

Hello Brian Tao, your solution is running, but what about if I have multiple data? can you give me example more than 2 data to sent to asp server?
SOLUTION
Avatar of Shalu M
Shalu M
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Whing Dela Cruz

ASKER

Hello Scott fell, Your codes above is also work. Thank you!,
Avatar of Whing Dela Cruz

ASKER

Thank you also Shalu M. now I can send multiple data to server side..
Avatar of Whing Dela Cruz

ASKER

Thanks a lot for providing me solution guys, comments and guides are greatly appreciated. More power to all of you and God Bless you all!
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo