我每30秒對ajax調用java方法。 我在java方法中設置了很少的請求參數。從Ajax響應中獲取請求參數
如何從ajax響應中獲取它們?
<script LANGUAGE="JavaScript1.2">
var tId = window.setTimeout(function() {
location.reload(true);
alert('<s:property value="#disableReload" />');
if('<s:property value="#disableReload" />' == "true"){
alert("clearing");
}else{
var url = 'moveETHAction_fetchExecutorData.action';
var form = document.getElementById('moveForm');
var params = Form.serialize(form) + '&ms=' + new Date().getTime();
form.action = "fetchExecutorData";
var myAjax = new Ajax.Request(url, {method: 'post', parameters: params, onComplete: showResponseAction});
}
}, 30 * 1000);
function showResponseAction(originalRequest){
alert(originalRequest.responseText);
alert('<s:property value="#request[\'DISABLE_FLOW'\]" />');
document.getElementById('actionChange').innerHTML = originalRequest.responseText;
}
</script>
在Java方法,我設置此參數
了request.setAttribute(GenericConstants.DISABLE_FLOW,假);
,但我不從阿賈克斯
我解決了這個問題,通過向ajax結果jsp添加一些數據,並基於此我改變了原來的jsp – Reddy