我想在通过php返回的链接之前显示图像。 下面是ajax代码
$.ajax({ //Make the Ajax Request
type: "POST",
url: "dbtryout2_2.php",
data: datastr,
success: function (arrayphp) {
//how to display image before this link
var link = $('<a href="#" class="my-class">' + arrayphp + '</a>');
$(".searchby .searchlist").append(link);
}
});
答案 0 :(得分:0)
只需在链接前附加图片。
$.ajax({ //Make the Ajax Request
type: "POST",
url: "dbtryout2_2.php",
data: datastr,
success: function (arrayphp) {
//how to display image before this link
var link = $('' + arrayphp + '');
var image = "<img src='http://www.yourdomain.com/iamge.png' alt='' />"
$(".searchby .searchlist").append(image).append(link);
}
});