Need help about using XMLHTTP

admin

Administrator
Staff member
Hi there:

I am trying to use XMLHTTP to develop a simple platform independent application. It's a html file that sends a xml search string to a web server, gets returned search results and show the results.

My code to use XMLHTTP:
----------
//send a search key and get back search results
var xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttp.open("POST", url, false);
xmlHttp.setRequestHeader ("MessageType", "Call");
xmlHttp.setRequestHeader ("Content-Type", "text/xml");
xmlHttp.send(strSearch);

var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async= "false";
xmlDoc.loadXML (xmlHttp.responseText);

//display search results using xmlDoc
......

code Note:
------------
url: a string of server url, such as <!-- m --><a class="postlink" href="http://www.google.com/api">http://www.google.com/api</a><!-- m -->
strSearch: a xml string containing a user entered search key

My problem:
--------------
The file works well from my local machine. I can successfully run the file in IIS folder or any other folders of my computer. However, when I upload the file into a remote server, there is always an access deny error. The error message is "Line 64, Error: Access deny". The error line is the first line of my above code. That is to create a XMLHTTP object. I searched W3C and MSN about the use of XMLHTTP, and found that both IE5+ and Netscap6 support the com. I can't figour out what's wrong.

Can anybody help me to make it streight? Thanks in advance.

Lee
 
Back
Top