【发布时间】:2020-11-19 23:16:57
【问题描述】:
我有如下代码:-
$(document).ready(function () {
$("#tableA").on("click", function () {
$.ajax({
type: "POST",
url: "Testing.ashx",
success: function (output) {
output = JSON.parse(output);
DrawTableA(output);
}
})
});
$("#tableB").on("click", function () {
$.ajax({
type: "POST",
url: "Testing.ashx",
success: function (output) {
output = JSON.parse(output);
DrawTableB(output);
}
})
});
}
<table id=tableA>tableA</table>
<table id=tableB>tableB</table>
我希望只把它变成一个函数而不是使用两个函数,因为属性都是一样的
【问题讨论】:
标签: javascript html jquery asp.net json