Bootstrap

js拼接HTML onclick传参

在这里

> 插入
html += '<p class="classify" id="'+goodsCategoryId+'"οnclick="selGoods(\' '+storeSn+ ' \',\' '+goodsCategoryId+ ' \')">'+ name+'</p>';
代码片

function selGoods(storeSn,goodsCategoryId){

			$.ajax( {
				type : "POST",
				dataType : "json",
				url : "${base}/weixin/getgoodinfo",
				data : {"storeSn":storeSn,"goodsCategoryId":goodsCategoryId},
				success : function(data) {
					if(data.status=="success"){
						var html ="";
						for(var i=0;i<data.goodsList.length;i++) {
							var pic = data.goodsList[i].pic;
							var fullName = data.goodsList[i].fullName;
							html += '<div class="floorDetailsItme">';
							html += '<img src="'+pic+'" class="floorShopLogo">';
							html += '<div class="shopNameAnd">';
							html += '<p class="theShopName">'+ fullName+'</p>';
							// html += '<p class="theShopJS">'+ fullName+'</p>';
							html += '</div>';
							html += '</div>';
						}
						$(".floorDetail").html(html)
					}
				},
				error : function(XMLHttpResponse) {
					$.alert("网络异常,请稍后重试!");
				}
			});
		}
;