Ajax asynchronous url mass participation issues

 

Today, when a discovery about ajax url traditional values, the issue of access time value drop-down list of options likely to encounter:

 

 

 

/**异步提交**/
var xmlHttp;
function selectListResult(){
	var f=document.selectForm;
	var branch=f.selectbranch.value;
	var depart=f.selectdepart.value;
	var name=f.UserName.value;
	var time=f.Time.value;  	
	var url=${basePath}"findScheduleByManyAction.action?BId="+branch+"&DId="+depart+"&UserName="+name+"&Time="+time;
	alert(url);
	xmlHttp=createXMLHttpRequest();
	/*设置回调函数*/
	xmlHttp.onreadystatechange=processRequest;
	/**打开连接*/
	xmlHttp.open("GET",url,true);
	/**发送请求*/
	xmlHttp.send(null);
}

 

 

 

This is jsp pages, dynamic acquisition value, < Option value = "$ {branchid}" > and < Option value = "branchid" > at run time can be removed value, but Ajax acquired value = "$ {branchid}" in value is an int, Ajax acquired value = "branchid" value Shique "branchid" string, it is necessary to use the EL expression when used Ajax.

 

 

<td width="261" height="37">选择机构:
            <select name="selectbranch">
            <option value="0">=不限=</option>
            <s:iterator value="branchList">
             <option value="${branchid}"><s:property value="branchshortname"/></option>
            </s:iterator>
            </select>
          </td>

<td width="261" height="37">选择机构:
            <select name="selectbranch">
            <option value="0">=不限=</option>
            <s:iterator value="branchList">
             <option value="branchid"><s:property value="branchshortname"/></option>
            </s:iterator>
            </select>
          </td>

 

 

 

 

 

 

Reproduced in: https: //my.oschina.net/u/2260184/blog/540552

Guess you like

Origin blog.csdn.net/weixin_33921089/article/details/92186219