需要你help.I想写像阿贾克斯<C:IF>
一些JSTL代码,但它合乎理不行JSTL在AJAX不起作用
function myfunction(cd){
$("#datatable tbody").empty();
$.ajax({
url :'/KurirCC/management-user-by-request.html',
cache :true,
data :{"kode":cd},
dataType :"json",
type : "GET",
contentType : "application/json; charset=utf-8",
success : function(jsondata){
$.each(jsondata.data,function(i,obj){
var status = obj.sts;
tableHtml ="<tr> <td>"+ obj.id_mobile + "</td> <td>" + obj.nama +"</td> <td>"+ obj.username +"</td> <td>"
+ obj.kota + "</td> <td><c:if test="${status == 1}">Aktiv</c:if></td><td align='center'><button type='button' class='btn tom-history' title='History' ></button></td> </tr>";
$(tableHtml).appendTo('#datatable tbody');
});
}
});
}
这段代码<td><c:if test="${status == 1}">Aktiv</c:if></td>
不行, 其中问题在哪里?
这是没有意义的。有关如何工作的基本解释,请参阅重复内容。 JavaScript有它自己的'if()'语句。利用它。 – BalusC