03.
04.
05.
<script>
06.
07.
08.
09.
10.
11.
function
SigmalRUpdateData(){
12.
13.
var
myjson =
'{"tType":"CUSTOMER","aoCustomer":[{"FTCstType":1,"FDXihDocDate":12/08/2018,"FTXihDocTime":15:00:00}]}'
;
14.
15.
16.
var
myArr = $.parseJSON(myjson);
17.
18.
for
(
var
i = 0; i<myArr[
'aoCustomer'
].length;i++){
19.
20.
tGpgCode = myArr[
'aoCustomer'
][i].FTCstType;
21.
tPgpName = myArr[
'aoCustomer'
][i].FDXihDocDate;
22.
nPaymentAmt = myArr[
'aoCustomer'
][i].FTXihDocTime;
23.
24.
25.
nCountPgpRow = $(
'table tr td:contains("'
+tGpgCode+
'")'
).length
26.
27.
if
(nCountPgpRow == 0){
28.
$(
'#otbPaymantGroup'
).append($(
'<tr>'
)
29.
.append($(
'<td>'
)
30.
.text(tGpgCode)
31.
.attr(
'id'
,
'otdStkGpg'
+tGpgCode)
32.
)
33.
34.
.append($(
'<td>'
)
35.
.text(nPaymentAmt)
36.
.attr(
'id'
,
'otdPayMentAmt'
+tGpgCode)
37.
)
38.
);
39.
}
else
{
40.
41.
nLastAmt = parseFloat($(
'#otdPayMentAmt'
+tGpgCode).text());
42.
nIncommingAmt = parseFloat(nPaymentAmt);
43.
nNewAmt = nLastAmt + nIncommingAmt;
44.
$(
'#otdPayMentAmt'
+tGpgCode).text(nNewAmt);
45.
}
46.
}
47.
}
48.
</script>
49.
50.
<button onclick=
"SigmalRUpdateData()"
>SignalR</button>
51.
52.
<table
class
=
"table table-bordered"
id=
"otbPaymantGroup"
>
53.
<thead>
54.
<tr>
55.
<th>นักศึกษา/อาจารย์</th>
56.
<th>บุคคลทั่วไป</th>
57.
<th>โชลเชี่ยล</th>
58.
</tr>
59.
</thead>
60.
<tbody>
61.
<tr>
62.
<td id=
"otdStkGpg1"
>2</td>
63.
<td id=
"otdStkGpg1"
>0</td>
64.
<td id=
"otdStkGpg1"
>0</td>
65.
</tr>
66.
</tbody>
67.
</table>