Javascript XMLHTTPRequest-表单提交而不刷新时,currentPage参数未更新
我有如下功能:Javascript XMLHTTPRequest-表单提交而不刷新时,currentPage参数未更新,javascript,jsp,xmlhttprequest,Javascript,Jsp,Xmlhttprequest,我有如下功能: function submitNextPageRequest() { createRequest(); request.open("POST", "getFilteredData? pageIndex=${currentPage+1}&channelName=${channelName}&modelType=${modelType}&queryparam=${queryparam}",true);
function submitNextPageRequest() {
createRequest();
request.open("POST", "getFilteredData? pageIndex=${currentPage+1}&channelName=${channelName}&modelType=${modelType}&queryparam=${queryparam}",true);
request.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded; charset=UTF-8");
request.onreadystatechange = showResults;
request.send();
}
我从按钮中单击onclick
调用此函数
<button type="button" id="nextBtn" name="nextBtn" onclick="submitNextPageRequest()">Next</button>
下一步
应用程序行为:
最初,页面将加载10个结果页面
单击next按钮后,pageIndex参数将作为2传递。这个参数将在servlet中检索,我将根据pageIndex参数加载并发送下10个结果到JSP。
在发送到JSP时,我将请求属性中的pageIndex设置为2。因此,当我单击Next时,pageIndex将变为3
在第2页,我单击下一步按钮。但是页面索引仍然是2
谁能在这个问题上帮助我。提前非常感谢。为了参考,我还附加了以下函数:函数showResults(){if(request.readyState==4){if(request.status==200){document.getElementById(“searchResults”).innerHTML=request.responseText;}}}函数createRequest(){try{request=new XMLHttpRequest();}catch(noXMLHttpRequestException){try{request=newActiveXObject(“Msxml2.XMLHTTP”);}catch(noMsxml2XMLHTTPException){try{request=newActiveXObject(“Microsoft.XMLHTTP”);}catch(noMicrosoftXMLHTTPException){request=false;}}是否有任何方法可以在每次单击JSP中的“下一步”按钮时将pageIndex增加1。。?