阅读背景:

ajax json 动态传值

来源:互联网 
<a href="/go.html?url=#" onclick="getRightInfo(${v.ctid})"></a>

<div id="rightinfo"></div>

<script type="text/javascript">
	$(document).ready(function() {
		
	});
	
	function getRightInfo(ctid) {
		$.ajax({
			url : "${contextPath}/web/infoshoplist.htm",
			data : "ctid="+ctid,
			cache : false,
			success : getRightInfoCallback
		});
	}

	function getRightInfoCallback(xmlHttp) {
		var mainfloor = xmlHttp.infocontactlist;
		
		if (mainfloor != null) {
			$("#rightinfo").hide();
			var str = '';
			
			for (var i = 0; i < mainfloor.length; i++) {
				str += '<a href="/go.html?url=${contextPath}/web/infocontact.htm?contactid=' + mainfloor[i].contactid + '&userid=' + mainfloor[i].userid + '">';
				str += '<div class="media">';
				str += '<div class="yyright">';
				str += '<div class="media-left">';
				str += '<img id="bxg" class=" media-object" src="' + mainfloor[i].icon + '">';
				str += '</div>';
				str += '<div class="media-body">';
				str += '</a>';
				str += '<a href="/go.html?url=${contextPath}/web/editinfocontact.htm?contactid=' + mainfloor[i].contactid + '&userid=' + mainfloor[i].userid
						+ '">';
				str += '联系人:' + mainfloor[i].sname;
				str += '<br>';
				str += '</div>';
				str += '</div>';
				str += '</div>';
				str += '</a>';
			}
			//alert(str);
			
			$("#rightinfo").html(str);
			$("#rightinfo").show();
			
		} else {
			$("#rightinfo").hide();
		}
	}
</script>


@RequestMapping("/infoshoplist.htm")
	@ResponseBody
	public Map<String, Object> infoshoplist(Model model, RequestParameter param) {

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("infoshoplist", webService.getInfoShopList(param.getCtid()));
		return map;
	}
<a href="/go.html?url=#" onclick="getRightI



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: