日期:2014-05-18 浏览次数:20577 次
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CallWebMethod.aspx.cs" Inherits="ajax_jquery_CallWebMethod" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<style type="text/css">
.jTemplatesTest {
background: #DDD;
border: 1px solid #000;
margin: 2em;
width: 480px;
}
.jTemplatesTest * {
padding: 4px;
margin: 2px auto;
}
.jTemplatesTest td,tr {
background: #EEE;
border: 1px solid black;
}
</style>
<script src="jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="jquery-jtemplates.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$("#start").click(function() {
$.ajax({
type: "POST",
url: "jQueryWebService.asmx/GetDT",
data: "{}",
contentType: "application/json; charset=utf-8",
success: function(msg) {
ApplyTemplate(eval('(' + msg.text + ')'));
}
});
});
});
function ApplyTemplate(data) {
$('#result').setTemplateElement('template');
$('#result').processTemplate(data);
}
</script&g