This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="divResult" class="mycss"></div> | |
<script src="http://code.jquery.com/jquery-1.10.2.js"></script> | |
<script src="http://web2.systemlead.com/iticket/scripts/jquery.tmpl.js"></script> | |
<style> | |
.mycss ul | |
{ | |
list-style-type: none; | |
padding:10px; | |
} | |
.mycss ul li | |
{ | |
display:inline-block; | |
border-width:1px; | |
border-color:grey; | |
border:solid; | |
padding:10px; | |
} | |
</style> | |
<!--產品範本定義--> | |
<script id="tmplUser" type="text/x-jquery-tmpl"> | |
<ul> | |
<li> | |
${$data.USER_NAME} | |
</li> | |
<li> | |
${$data.CLUBNAME} | |
</li> | |
<li> | |
${$data.CLU_TTTLE} | |
</li> | |
<li> | |
${$data.CLU_TTTLE_TAG} | |
</li> | |
</ul> | |
</script> | |
<script> | |
$(function () { | |
SearchResult(); | |
}); | |
//精選特惠 | |
function SearchResult() { | |
var ClubID = "K1001"; | |
var apiUrl="https://webapi.systemlead.com/catalogapi/club/GetPublicClubUser?ClubID="+ClubID; | |
$.ajax({ | |
url: apiUrl, | |
//data: null, | |
success: function (obj) { | |
var result = new Array(); | |
$.each(obj,function(i,item) | |
{ | |
var data = new Object(); | |
data.CLUBNAME=item.CLUBNAME; | |
data.USER_NAME=item.USER_NAME; | |
data.CLUB_TITLE = item.CLUB_TITLE; | |
data.CLUB_TITLE_TAG=item.CLUB_TITLE_TAG; | |
var flag='N'; | |
$.each(result,function(ii,iitem){ | |
if(iitem.USER_NAME==item.USER_NAME){ | |
flag='Y'; | |
} | |
}); | |
if(flag=='N'){ | |
result.push(data); | |
} | |
}); | |
try{ | |
$('#tmplUser').tmpl(result, { | |
getTags: function (separator) { | |
return this.data.tags.join(separator); | |
} | |
}).appendTo($('#divResult')); | |
} | |
catch(err){alert(err);} | |
},fail: function (err) { | |
alert(err); | |
}, | |
dataType: 'JSON' | |
}); | |
} | |
</script> |
沒有留言:
張貼留言