踩顶功能ajax_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > 踩顶功能ajax

踩顶功能ajax

 2011/9/29 8:03:01  zhq426  http://yiqila.iteye.com  我要评论(0)
  • 摘要://投赞成票functiondoContentVote(siteId,contentId){varurl=cp+"/jsp/portal/opcontent/content_service.jsp?action=doVote&contentId="+contentId+"&siteId="+siteId;if(window.XMLHttpRequest){req=newXMLHttpRequest();}elseif(window.ActiveXObject)
  • 标签:功能 Ajax

?

?

	//投赞成票
	function doContentVote(siteId,contentId) {
	    var url = cp+"/jsp/portal/opcontent/content_service.jsp?action=doVote&contentId="+contentId+"&siteId="+siteId; 
	    if (window.XMLHttpRequest) { 
	        req = new XMLHttpRequest(); 
	    }else if (window.ActiveXObject) { 
	        req = new ActiveXObject("Microsoft.XMLHTTP"); 
	    } 
		if(req){ 
		    req.open("POST", url, true); 
		    req.onreadystatechange = callbackContentVote; 
		    req.send(null);  
		} 
	} 
	//回调函数
	function callbackContentVote() { 
	    if (req.readyState == 4) { 
	        if (req.status == 200) { 
	           var obj = eval("("+req.responseText+")");
            	if(obj.flag==0) {
            		alert("您的投票次数已达上限!");
            	}else{
					alert("投票成功"+obj.voteCount);
					document.getElementById("voteCountId").innerHTML=obj.voteCount;         	
            	}
	        }else{ 
	        	alert ("投赞成票出错:" + req.statusText); 
	        }        
	    } 
	} 

?

java

JSONObject obj = JSONObject.fromObject(retMap);
			out.print(obj.toString());
?

?

发表评论
用户名: 匿名