2012-08-17 76 views
0

我用下面的線在我的代碼使用JavaScriptJavaScript代碼給於Chrome和Firefox

var ns = (wsdl.documentElement.attributes["targetNamespace"] + "" == "undefined") ? wsdl.documentElement.attributes.getNamedItem("targetNamespace").nodeValue : wsdl.documentElement.attributes["targetNamespace"].value; 

上述JavaScript程式碼使用Web服務是在IE和Safari瀏覽器上運行良好,但在Chrome和Firefox的錯誤是在控制檯上拋出錯誤:

XMLHttpRequest cannot load http://192.168.50.141:4323/HelloWorld.asmx?wsdl. Origin null is not allowed by Access-Control-Allow-Origin. 
Uncaught TypeError: Cannot read property 'documentElement' of null 

請幫助

由於提前

+0

'原產地空沒有被允許當我使用訪問控制允許-Origin.'告訴原因。 – xdazz 2012-08-17 09:36:11

+0

你在哪裏運行代碼?它確實不在'http://192.168.50.141:4323 /'上? – pimvdb 2012-08-17 09:36:53

回答

0

如果您使用命令行

chrome.exe --disable-web-security 

運行鉻這是發展

相關問題