Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP XML Using ASP 3 and XML. See also the XML category for more XML discussions not relating to ASP. NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 4th, 2004, 05:32 AM
vvr vvr is offline
Registered User
 
Join Date: Dec 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with using POST method with XMLHTTP

How could I use POST method to transfer parameters with XMLHTTP?
With GET all works correct, but with POST I get a problem.

client.asp with GET - all works
<head>
<title> XMLHTTP Example </title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<%
dim objXMLHTTP
set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.Open "GET", "http://localhost/test/server.asp?fName=Mitchell", false
objXMLHTTP.Send
Response.Write(objXMLHTTP.responseText)
set objXMLHTTP = nothing
%>
</body>
</html>

client2.asp with POST - doesn't works
<head>
<title> XMLHTTP Example </title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<%
dim objXMLHTTP
set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.Open "POST", "http://localhost/test/server.asp", false
objXMLHTTP.Send("fName=Mitchell")
Response.Write(objXMLHTTP.responseText)
set objXMLHTTP = nothing
%>
</body>
</html>

server.asp
<%
dim fName
if Request.ServerVariables("HTTP_METHOD") = "GET" then
    fName = Request.QueryString("fName")
elseif Request.ServerVariables("HTTP_METHOD") = "POST" then
    fName = Request.Form("fName")
end if
Response.Write "<Name_Details>"
Response.Write "<TheName>"
Select Case fName
    Case "Mitchell"
        Response.Write fName & " Harper"
    Case "John"
        Response.Write fName & " Doe"
    Case "Harry"
        Response.Write fName & " Potter"
    Case Else
        Response.Write "[Unknown]"
End Select
Response.Write "</TheName>"
Response.Write "</Name_Details>"
%>

  #2 (permalink)  
Old December 6th, 2004, 01:44 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Please check the following link:

http://www.4guysfromrolla.com/webtech/110100-1.shtml

Om Prakash


Similar Threads
Thread Thread Starter Forum Replies Last Post
post xml using xmlhttp in vb.net datakix Classic ASP XML 4 August 7th, 2009 05:31 AM
Request Post XMLHttp : Need Help Kyum BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6 5 July 5th, 2007 09:51 PM
post xml using xmlhttp in vb.net datakix VB.NET 3 December 21st, 2004 01:31 PM
XML Post using microsoft.XMLHTTP csmajor231 XML 0 April 5th, 2004 03:06 PM
Using XMLHTTP to POST form data channer Classic ASP XML 8 January 6th, 2004 05:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.