Javascript XMLHTTPRequest未从LotusScript代理接收响应
我有一个LotusScript代理,它的末尾有以下代码Javascript XMLHTTPRequest未从LotusScript代理接收响应,javascript,xmlhttprequest,lotusscript,Javascript,Xmlhttprequest,Lotusscript,我有一个LotusScript代理,它的末尾有以下代码 Set nam = session.Createname(respParty) Print "Content-type: text/plain" Print nam.Abbreviated 我有一个JavaScript按钮,在提交()之前包含以下内容 除了返回一个空白值外,其他一切都正常工作 如果我放置URL: 在我将其传递到JS代码时,它将返回: X Content-type: text/plain Susanne Ander
Set nam = session.Createname(respParty)
Print "Content-type: text/plain"
Print nam.Abbreviated
我有一个JavaScript按钮,在提交()之前包含以下内容
除了返回一个空白值外,其他一切都正常工作
如果我放置URL:
在我将其传递到JS代码时,它将返回:
X Content-type: text/plain Susanne Anderson/CBS
我做错了什么
我的JS代码顺序是否错误
var noEmployees = document.getElementById('NoEmployees').value;
var stateName = document.getElementById('State').value;
var url = 'http://' + window.location.host + '/ebsprospects.nsf/GetResponsiblePerson?OpenAgent&NoEmployees=' + noEmployees + '&State=' + stateName;
var xhttp = new XMLHttpRequest();
xhttp.open("GET", url);
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
alert (xhttp.responseText);
document.getElementById("ResponsibleParty").innerHTML = xhttp.responseText;
}
};
xhttp.send();
希望这会有所帮助
希望这会有所帮助。我认为您需要在执行.open()之前定义onreadystatechange。还要将您的警报和innerHTML语句放在IF语句中。我认为您需要在执行.open()之前定义onreadystatechange。还要将您的警报和innerHTML语句放在IF语句中。
var noEmployees = document.getElementById('NoEmployees').value;
var stateName = document.getElementById('State').value;
var url = 'http://' + window.location.host + '/ebsprospects.nsf/GetResponsiblePerson?OpenAgent&NoEmployees=' + noEmployees + '&State=' + stateName;
var xhttp = new XMLHttpRequest();
xhttp.open("GET", url);
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
alert (xhttp.responseText);
document.getElementById("ResponsibleParty").innerHTML = xhttp.responseText;
}
};
xhttp.send();