ServerXMLHTTP는 앱에서 호스팅하는 서버 측 코드에서 사용되므로 동기화되어 있어도이 페이지를 호출하면 일반 XmlHttp를 사용하여 비동기가 될 수 있으므로 앱과 관련이 있습니다. 본질적으로 브라우저의 사이트 간 스크립팅 제한을 극복하기 위해 서버에 프록시를 만듭니다.
서버 측 :
<% Function RemoteMethod1(ByVal param1, ByVal param2) 'Use ServerXMLHttp to make a call to remote server RemoteMethod = ResultFromRemoteServer End Function Function RemoteMethod2(ByVal param1, ByVal param2) 'Use ServerXMLHttp to make a call to remote server RemoteMethod = ResultFromRemoteServer End Function 'Read QueryString or Post parameters and add a logic to call appropriate remote method sRemoteMethodName = Request.QueryString("RemoteMethodName") If (sRemoteMethodName = RemoteMethod1) Then results = RemoteMethod1(param1, param2) Else If (sRemoteMethodName = RemoteMethod2) Then results = RemoteMethod1(param1, param2) End If 'Convert the results to appropriate format (say JSON) Response.ContentType = "application/json" Response.Write(jsonResults) %>
Proxy.asp
지금 (jQuery의해서 getJSON 말) AJAX를 사용하여 클라이언트 측에서이 Proxy.asp를 호출합니다. 따라서 서버가 차단되는 동안 클라이언트의 호출은 여전히 비동기입니다.
클라이언트 측 :
$.getJSON('proxy.aspx?RemoteMethodName=RemoteMethod1&Param1=Val1&Param2=Val2', function(data) {
// data should be jsonResult
});
가 ([이]를 살펴 보자 http://stackoverflow.com/questions/1576040/synchronous-cross-sub-domain-post-request-with-jquery) SO 스레드. –