不完善
html
<form>
<input type="hidden" id="field" name="field" value="product_id">
<input type="hidden" id="sort" name="sort" value="ASC">
<input type="hidden" id="pageNo" name="pageNo" value="1">
<input type="hidden" id="productName" value="" name="productName">
</form>
</form>
<table id="table">
<tr>
<th><a class="identification" id="nameproduct">产品名称</a></th>
</tr>
</table>
$("#nameproduct").click(function() {
if ($(this).hasClass("identification")) {
$("#field").val("product_name");
$("#sort").val("DESC");
init();
$(this).removeClass("identification")
} else {
$("#field").val("product_name");
$("#sort").val("ASC");
init();
$(this).addClass("identification")
}
} )
order by ${field} ${sort} // 注意升序降序不用#