日期:2014-05-16  浏览次数:20718 次

踩顶功能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());
?

?

1 楼 zhq426 2011-09-27  
将夜
2 楼 zhq426 2011-09-27  
3 楼 litianyi520 2011-09-27  
小功能不错
4 楼 zhq426 2011-09-28  
litianyi520 写道
小功能不错

litianyi520 写道
小功能不错