|
Newbie, I am having some trouble with an apparently simple request -- barclaymichael --
Hello, thanks in advance for reading this. I was trying to do an excercise from a book I was reading (although i've striped away most of the code to find my unfindable problem) and have ended up with this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>index</title> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content=" http://schemas.microsoft.com/intellisense/ie5 "><meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name="ProgId" content="VisualStudio.HTML"> <meta name="Originator" content="Microsoft Visual Studio .NET 7.1"> <script language="javascript"> // var XHRO = false; var options; if (window.XMLHttpRequest) { XHRO = new XMLHttpRequest(); } else if (window.ActiveXObject) { XHRO = new ActiveXObject("Microsoft.XMLHTTP"); } function getOptions(scheme) { if(XHRO) { XHRO.open("POST", "postasp.aspx", true); XHRO.setRequestHeader('ContentType', 'application/x-www-form-urlencoded; charset=utf-8'); XHRO.send('h=1'); XHRO.onreadystatechange = function() { if(XHRO.status == 200 && XHRO.readyState == 4) { alert(XHRO.responseText); } } } } </script> </head> <body MS_POSITIONING="GridLayout"> <form ID="Form1"> <select size="1" id="optionList" onchange="setOption()" NAME="optionList"> <option selected>Apreta el botón</option> </select> <input type="button" value="Aprétame" onclick="getOptions('1')" ID="btn_ColorScheme1" NAME="btn_ColorScheme1"> <br /> <br /> </form> </body> </html> ************************************************************************* ************************************************************************* And this: postasp.aspx <%@ Page Language="VB" AutoEventWireup="false" CodeFile="postasp.aspx.vb" Inherits="postasp" %> postasp.aspx.vb Partial Class postasp Inherits System.Web.UI.Page Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Response.ContentType = "text/xml" If Request.Form("h") <> "" Then Response.Write(Request.Form("h")) Else Response.Write("Nada") End If End Sub End Class Somehow it worked once on another pc, but i cant make it work here, maybe its something obvious (i hope it is), but i am new to this (disclaimer :P) and have been troubled by this problem for about a week. Thanks, Michael B |