Our office team maintains and develops a Classic ASP application using VBScript
We came across a technical task that involves creating links. When the link is clicked, we want our ASP page to invoke a POST.
The POST should be indirectly invoked by the link in the ASP.
Here is the VBScript code and link in the ASP page that invokes a VBSCript Subroutine which will ultimately invoke a POST:
<%dim whereFrom
whereFrom = "RevSummary"
dim critiqueID
critiqueID = 389
dim orignalCritiqueID
orignalCritiqueID = 249
%>
<a href="#" onclick="<%=vbscript:showCritiqueDetailsInvocation( whereFrom, critiqueID, orignalCritiqueID )%>" class="TenPtList" target="_blank">
<font color="blue">
Critique Details
</font>
</a>
<%
Sub ShowCritiqueDetails(WhereFromArg, CritiqueIDArg, OrignalCritiqueIDArg )
dim DataToSend : DataToSend = "WhereFrom=" + WhereFromArg + "&CritID=" + CritiqueIDArg + "&OriginalCritID=" + OrignalCritiqueIDArg
dim servXmlHttp
dim urlOfInterest : urlOfInterest = Application("RAMSREVURL") + "CritiqueDetailsPopup.asp"
set servXmlHttp = server.Createobject("MSXML2.ServerXMLHTTP")
servXmlHttp.Open "POST", urlOfInterest ,false
servXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
servXmlHttp.send DataToSend
Set servXmlHttp = nothing
End Sub
%>
The ultimate desired requirement is that we want the POST to be invoked, and then we want to navigate to the page called CritiqueDetailsPopup.asp
Will the above approach? Also, is the above approach a good programming practice?