试试这个方法......
<html>
<head>
<script>
$(document).ready(function(){
dialogCust = $("#custAddList").dialog({
autoOpen: false,
height: 200,
width: 950,
modal: true
});
$.ajax({
type: "POST",
url: serviceUrl ,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
if (data.length > 0) {
$.each(data, function (i, item) {
$('<tr>').append(
$('<td>').text(item.Name),
$('<td>').text(item.Code)
).appendTo('#custAddList').last().after();
});
dialogCust.dialog("open");
} else {
alert("Not found address for customer.");
}
},
error: function (a, b, c) {
alert(c);
}
});
});
</script>
</head>
<body>
<table id="custAddList">
</table>
</body>
</html>