ajax 基本应用-未封装

ServletActionContext.getResponse().getWriter().write(JSONArray.fromObject(browsePhotList).toString());

<!--
	var XMLHR;
	function createXMLHttpRequest()
	 {
		if(window.ActiveXObject){
			try{
				XMLHR=new ActiveXObject("Msxml2.XMLHTTP");
			}catch(e){
				XMLHR=new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		else if(window.XMLHttpRequest)
		{
			XMLHR=new XMLHttpRequest();
		}
	 }
	
	function MangagePhoto(albumID)
	 {
		createXMLHttpRequest();
	    var url="queryPhoto.action"
	    XMLHR.open("post",url,true);
	    XMLHR.setRequestHeader("content-Type","application/x-www-form-urlencoded");
		XMLHR.onreadystatechange=MangagePhotoCallBack;
	    XMLHR.send("albumID="+albumID);
	 }
	
	function MangagePhotoCallBack()
	 {
		if(XMLHR.readyState == 4)
	     	{
	     		if(XMLHR.status == 200)
	     		{
	     			var result = eval('('+XMLHR.responseText+')');
					var str='<table width="90%"  border="1">';
					//var MangagePhotoPath = document.getElementById('MangagePhotoPath').value;
					for(var i=0;i<result.length;i++)
					{
						str += '<td><table width="140" height="120" border="1"><td width="160">'
						var imageName = result[i];
						str += '<img src= d:\\upload\\'+imageName + ' width="140" height="120">';
						str += '</td></table></td>';
					}
					str += '</table>';

	     			document.getElementById('photoList').innerHTML = str;
	     			document.getElementById('photoList').style.display = '';
	 			}
	 		}
	 }

var XMLHR;
		function createXMLHttpRequest()
		{
			if(window.ActiveXObject){
				try{
					XMLHR=new ActiveXObject("Msxml2.XMLHTTP");
				}catch(e){
					XMLHR=new ActiveXObject("Microsoft.XMLHTTP");
				}
			}
			else if(window.XMLHttpRequest)
			{
				XMLHR=new XMLHttpRequest();
			}
		}
		function ajaxCy()
		{
			var yazzjgbh = document.getElementById('orgn').value;
			alert(yazzjgbh);
			createXMLHttpRequest();
		    var url="<%= contextPath%>/prepareScheme/AjaxGetOrganizedName";
		    XMLHR.open("post",url,true);
		    XMLHR.setRequestHeader("content-Type","application/x-www-form-urlencoded");
			XMLHR.onreadystatechange=processRequest;
		    XMLHR.send("PrepareSchemeOrganizeId="+yazzjgbh);
		}
		function processRequest()
		{
	      	if(XMLHR.readyState == 4)
	      	{
	      		alert('no fan hui ');
	      		if(XMLHR.status == 200)
	      		{
	      			alert('success');
	      			document.getElementById("deptLinkManTel").innerHTML=XMLHR.responseText;
	  			}
	  		}
	  	}




		================
		 response.setContentType("text/html;charset=utf-8");
		 response.getWriter().write(OrganizePersonnelName);

你可能感兴趣的:(html,Ajax,Microsoft)