【发布时间】:2014-02-23 11:40:21
【问题描述】:
我想在 ajax 成功后在特定的 td 中显示图像,但它不显示图像它不起作用任何人指导我如果我出错了下面是我的代码
ajax:
<script>
$(document).ready(function() {
$('.edit1').on('change', function() {
arr = $(this).attr('class').split(" ");
var clientid = document.getElementById("client").value;
account_id = document.getElementById("account_id").value;
$(this).parent().next().find('input:checkbox').attr("checked", true);
$.ajax({
type: "POST",
url: "clientnetworkpricelist/routestatusupdate.php",
data: "value=" + $(this).val() + "&rowid=" + arr[2] + "&field=" + arr[1] + "&clientid=" + clientid + "&account_id=" + account_id,
success: function(result) {
data = jQuery.parseJSON(result); //added line
var obj = data;
$('#CPH_GridView1_Status' + arr[2]).empty();
$('#CPH_GridView1_Status' + arr[2]).append(data.status);
$('.ajax').html($(this).val());
$('.ajax').removeClass('ajax');
}
});
});
});
</script>
routestatusupdate.php
{
/**
some function for display the result
**/
$result=array();
$result['status']='<img src="image/' . $status . 'f.png" />';
$result['seleniumrouteupdate']=$seleniumrouteupdaterow;
$result['routeupdate']=$routeupdate;
echo json_encode($result);
}
我的 routestatusupdate.php 输出看起来像
{"status":"<img src=\"image\/Increasef.png\" \/>","seleniumrouteupdate":"1","routeupdate":"100"}{"status":"<img src=\"image\/Decreasef.png\" \/>","seleniumrouteupdate":"1","routeupdate":"100"}
【问题讨论】:
标签: javascript php jquery html ajax