Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get the return text from the called url - asp / vbscript

Status
Not open for further replies.

sajisher

Programmer
Dec 3, 2003
45
US
The below code is part of an ASP file. The objective is to pass some data to the unix shell script in a Apache server and after all processing it returns the message - success or failed.

'Send the Transmit values through a popup window to Apache server
<script type="text/javascript">
url = " file1.ksh data1 data2"

window.open('<%=url%>', "Transmit", "width=650,height=500,toolbar=no,resizable=yes")
</script>

'if varSuccess > 0 then
objTran.Reset(val1,val2)
'end if

The question is how to capture this return message. If the return message is 'success' then we need to call the COM function 'Reset'.

Right now, the given url opens in a pop up window and the processing takes about 15 seconds. And while the url server is still procesing, execution goes to the Reset function, which should not happen.

Can anyone suggest please how to capture the return message/text from the server please and then depending on the success execute 'Reset' function.

thanks
 
You will have to use "AJAX" via the XMLHTTPRequest Object to send the request and return the response.



Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Thanks

Any idea what is the code to have a timer in the code below please - any link, was not successful in googling. Right now using a Msgbox to make execution wait to receive response from the called url because it takes about 10 seconds to receive response. If I don't use the Msgbox, it starts executing rest of the code in this asp file which should not happen.

thanks
saj

<script language="vbscript" type="text/vbscript">
dim url
url = "<%=vSubmitBatchURL%>"
'msgbox url

Dim objXML
Function objXML_onreadystatechange()
dim strResponse
If (objXML.readyState = 4) Then
If (objXML.status = 200) Then
strResponse = objXML.responseText
window.open strResponse "Test"
End If
End If
End Function

Set objXML = CreateObject("MSXML2.XMLHTTP.3.0")
objXML.Open "GET", url, True
objXML.OnReadyStateChange = GetRef("objXML_onreadystatechange")
objXML.Send
'this message box makes the application wait for the return result from Apache server
MsgBox "PLEASE DO NOT CLICK OK TILL FURTHER STATUS",vbCritical

</script>
 
Are you trying to run this server-side or client-side? Because your code is a mixture of both, with a bit of javascript thrown in for good measure.



Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top