The following article on msdn provides the ASP.NET AJAX solution of calling web service with AJAX... http://msdn.microsoft.com/en-us/magazine/cc163499.aspx like
<asp:ScriptManager ID="_scriptManager" runat="server">
<Services>
<asp:ServiceReference Path="StockQuoteService.asmx" />
</Services>
</asp:ScriptManager>
And then to use the class name directly in Jscript. But when I u开发者_如何学Goploaded the service on other domain and tried to do the same, it wouldn't work. Is there no way I can do it or am I missing something? Thanks in advance...
Due to the same origin policy restriction this is not possible. You cannot perform cross domain AJAX calls. One possible workaround is to use JSONP but you will need to have a web service which supports it.
You might like to give this a whirl if you are able to use Jquery:
http://jquery-howto.blogspot.com/2009/04/cross-domain-ajax-querying-with-jquery.html
Please install Fiddler2 and monitor your request/response, it's very helpful in troubleshooting ajax and web services issues.
精彩评论