Tuesday, 13 March 2012

JQuery with Template

Tutorial from
http://weblogs.asp.net/jan/archive/2010/10/05/getting-started-with-jquery-templates-and-sharepoint-2010.aspx

 


<script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js" type="text/javascript"></script>


<script id="tasktemplate" type="text/x-jquery-tmpl">
<li>
<b class="ms-rteFontSize-4">${Title}</b> - ${StatusValue}
<div>{{html Description}}</div>
</li>
</script>

<ul id="tasksUL"></ul>

<script type="text/javascript">
$(document).ready(function () {
$.getJSON(
"../_vti_bin/listdata.svc/Tasks?$filter=StatusValue ne 'Completed'", null,
function (data) {
alert("hello " + data.d.results);
$("#tasktemplate").tmpl(data.d.results).appendTo("#tasksUL");

});
});</script>

No comments:

Post a Comment