我有以下脚本将一些东西发布到服务器并将json结果写回用户浏览器.它没有按预期工作:(
$(document).ready(function () {
$('#productForm').ajaxForm({
dataType: 'json',
success: function (response) {
var tmp = '<tr>';
tmp += '<td><a href="/Invoice/DeleteProduct/' + response.Id +'>Kasta</a></td>';
tmp += '<td>' + response.Quantity + '</td>';
tmp += '<td>' + response.UnitPrice + '</td>';
tmp += '<td>' + response.ProfitRate + '</td>';
tmp += '<td>' + response.Description + '</td>';
tmp += '<td>' + response.Total + '</td>';
tmp += '</tr>';
$('#productsBody').append(tmp);
alternateRows();
},
clearForm: true,
resetForm: true,
timeout: 3000
});
});
Run Code Online (Sandbox Code Playgroud)
在firefox中一切都很好,在chrome中,新行根本没有显示,但是我的一些小区域会改变颜色.
在Internet Explorer 8中我没有得到链接,它将链接视为常规文本.我会再尖叫一下,希望有人能告诉我为什么当我从尖叫中回来时它不起作用.
尝试改变
tmp += '<td><a href="/Invoice/DeleteProduct/' + response.Id +'>Kasta</a></td>';
Run Code Online (Sandbox Code Playgroud)
至...
tmp += '<td><a href="/Invoice/DeleteProduct/' + response.Id +'">Kasta</a></td>';
Run Code Online (Sandbox Code Playgroud)