这段js是什么意思ajax
processResult=function(responseData,statusText,xhr,$form){if(!g_has_permission(respon...
processResult = function (responseData, statusText, xhr, $form) {
if (!g_has_permission(responseData)) return false;
// 'responseData' is the json object returned from the server
if (responseData) {
if (responseData['result'] == true) {
if (responseData['action'] == 'new') {
// 刷新结果,在表格的第一行显示新追加的数据
$('#shops tbody').append("<tr class='data_line' id='data_" + responseData['newShopId'] + "'>"
+ "<td>" + $('#manufacture_name').val() + "</td>"
+ '<td><a href="#" onclick="editShop(' + responseData['newShopId'] + ')">编辑</a> <a href="#" onclick="delShop(' + responseData['newShopId'] + ', this)">删除</a></td>'
+ "</tr>");
} else {
shopId = $('#shop_id').val();
$('#data_'+shopId).html("<td>" + $('#shop_name').val() + "</td>"
+ "<td>" + $('#homepage').val() + "</td>"
+ "<td>" + $('#original_country').val() + "</td>"
+ "<td>" + $('#telephone').val() + "</td>"
+ '<td><a href="#" onclick="editShop(' + shopId + ')">编辑</a> <a href="#" onclick="delShop(' + shopId + ', this)">删除</a></td>');
}
$.unblockUI();
} else {
for(var key in responseData['form_errors']) {
if (responseData['form_errors'][key]) {
$('#err_'+key).html(responseData['form_errors'][key]);
$('#err_'+key).show();
}
}
}
}
}; 展开
if (!g_has_permission(responseData)) return false;
// 'responseData' is the json object returned from the server
if (responseData) {
if (responseData['result'] == true) {
if (responseData['action'] == 'new') {
// 刷新结果,在表格的第一行显示新追加的数据
$('#shops tbody').append("<tr class='data_line' id='data_" + responseData['newShopId'] + "'>"
+ "<td>" + $('#manufacture_name').val() + "</td>"
+ '<td><a href="#" onclick="editShop(' + responseData['newShopId'] + ')">编辑</a> <a href="#" onclick="delShop(' + responseData['newShopId'] + ', this)">删除</a></td>'
+ "</tr>");
} else {
shopId = $('#shop_id').val();
$('#data_'+shopId).html("<td>" + $('#shop_name').val() + "</td>"
+ "<td>" + $('#homepage').val() + "</td>"
+ "<td>" + $('#original_country').val() + "</td>"
+ "<td>" + $('#telephone').val() + "</td>"
+ '<td><a href="#" onclick="editShop(' + shopId + ')">编辑</a> <a href="#" onclick="delShop(' + shopId + ', this)">删除</a></td>');
}
$.unblockUI();
} else {
for(var key in responseData['form_errors']) {
if (responseData['form_errors'][key]) {
$('#err_'+key).html(responseData['form_errors'][key]);
$('#err_'+key).show();
}
}
}
}
}; 展开
展开全部
if (responseData) { // 服务端有返回数据
if (responseData['result'] == true) // 判断返回JSON内容中的处理结果是否成功
{
if (responseData['action'] == 'new') { // 执行的是否是新增操作
$('#shops tbody').append(……); // 刷新结果,在表格的第一行显示新追加的数据
} else {
shopId = $('#shop_id').val(); // 找到shop_id的值
$('#data_'+shopId).html(……); // 用更新后数据重新绘制shopId对应的表格行
}
$.unblockUI(); // 解除页面遮罩
} else {
for(var key in responseData['form_errors']) { // 遍历form_errors
if (responseData['form_errors'][key]) { // 如果存在对应输入项错误信息
$('#err_'+key).html(responseData['form_errors'][key]); // 更新输入项错误信息内容
$('#err_'+key).show(); // 显示错误信息
}
}
}
if (responseData['result'] == true) // 判断返回JSON内容中的处理结果是否成功
{
if (responseData['action'] == 'new') { // 执行的是否是新增操作
$('#shops tbody').append(……); // 刷新结果,在表格的第一行显示新追加的数据
} else {
shopId = $('#shop_id').val(); // 找到shop_id的值
$('#data_'+shopId).html(……); // 用更新后数据重新绘制shopId对应的表格行
}
$.unblockUI(); // 解除页面遮罩
} else {
for(var key in responseData['form_errors']) { // 遍历form_errors
if (responseData['form_errors'][key]) { // 如果存在对应输入项错误信息
$('#err_'+key).html(responseData['form_errors'][key]); // 更新输入项错误信息内容
$('#err_'+key).show(); // 显示错误信息
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询