-2

リンクが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);

    }
});
4

1 に答える 1

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);

    }
});
于 2013-08-25T11:33:12.723 に答える