none
ajax .append function not working on first click c# .net

    คำถาม

  • Hi all,

    The below code loads the content from the database and appends it to the destination but

    in the first click the contents comes and goes off in a flash !!

    and it works well from the second click

    why is it happening ?!

    function buddyproducts() { $(document).ready(function () { $.ajax({ type: "GET", url: "Handlers/Hbuddyproducts.ashx", contentType: "application/json; charset=utf-8", data: { intuserid: globaluserid }, dataType: "json", responseType: "json", success: Retbuddyproducts }); function Retbuddyproducts(result) { $("#destination").html(''); $("#destination").empty(); $.each(result, function (i, data) { var prodid = data.intproductid; var chvusername = data.chvusername; var chvproductimg = data.chvproductimg; var prdresult = "<li data-id='" + prodid + "' class='util'> <img src='" + chvproductimg + "' width='92' height='92' alt='' onclick='tretrieveproduct(" + prodid + ")'/> <span>" + chvusername + "</span></li>"; $("#destination").append(prdresult); }); } }); }


    • ย้ายโดย Neddy Ren 14 มีนาคม 2555 4:47 asp.net issue (From:Visual C# Language)
    13 มีนาคม 2555 16:38

ตอบทั้งหมด