这是要点:
我有一个我想用asp打的电话,我不关心响应。我只想触发调用,我不希望页面等待响应。根据文档,它应该看起来像这样:
dim xmlhttp : set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", url, true '' setting the 'asynchronous' option to 'true'
xmlhttp.setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8"
xmlhttp.setRequestHeader "Content-Length", Len(XMLData)
xmlhttp.send XMLData
这在同步调用时效果很好,但是当我将异步选项翻转为“true”时,什么都不会触发。我可以从互联网上收集到的是用户执行以下操作:
While xmlhttp.readyState <> 4
xmlhttp.waitForResponse 1000
Wend
如果您正在等待响应,我是否疯了,因为这看起来不再像是一个异步调用?
放线
xmlhttp.waitForResponse 1
发送后立即会导致请求触发,但同样,我不想等待一秒钟。有什么想法吗?
最佳答案
今天我遇到了同样的问题。
我通过使用“Microsoft.XMLHTTP”对象解决了它。
dim xmlhttp
set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlhttp.Open "POST", url, true
xmlhttp.Send ""
现在请求被异步发送并且目标 URL 被命中。
希望有帮助。
关于asp-classic - 如何在 asp classic 中触发异步调用并忽略响应?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1510497/