Note that there are some explanatory texts on larger screens.

plurals
  1. PORetrieve Binary Image from DB via JSON and ashx then convert to image in html?
    primarykey
    data
    text
    <p>Ive been tasked to use this method, quite frankly id could do this server side in 2 sec's but need it all doing in javascript.</p> <p>So here goes, i need to retrieve a binary image from the DB thats returned in a object called S_TeamMember. One of the properties is MainImg byte[]</p> <p>im using JSON to call a ashx Handler to call the DB and retrieve the data.</p> <pre><code> $(function () { var queryparam = getUrlVars()["CatLink"]; $.ajax({ url: "TeamGroups.ashx", data: { CatLink: queryparam }, contentType: "application/json; charset=utf-8", dataType: "json", success: OnTeamGroupsCompleted, error: OnPageFailM }); }); </code></pre> <p>the JSON call above</p> <pre><code> function OnTeamGroupsCompleted(result) { for (var i = 0; i &lt; result.length; i++) { var name = result[i].Name; var recno = result[i].Recno; var mainimg = result[1].MainImg; var memholder = "&lt;div class='PersonImageHolder'&gt;" + "&lt;div class='PersonImage'&gt;" + "&lt;img src='"+ mainimg +"'/&gt;" + &lt;------ PROBLEM IS HERE "&lt;/div&gt;" + "&lt;div class='PersonNameHolder inline-block'&gt;" + "&lt;div class='ImgHolderL inline-block'&gt;" + "&lt;img src='images/web/WhiteRibbonL.png' /&gt;" + "&lt;/div&gt;" + "&lt;div class='NameHolder inline-block'&gt;" + "&lt;p&gt;&lt;a href='MemberDetail.aspx?TeammMemberLink="+ recno +"'&gt;"+ name +"&lt;/a&gt;&lt;/p&gt;" + "&lt;/div&gt;" + "&lt;div class='ImgHolderR inline-block'&gt;" + "&lt;img src='images/web/WhiteRibbonR.png' /&gt;" + "&lt;/div&gt;" + "&lt;/div&gt;" + "&lt;/div&gt;"; $('.Content').append(memholder); } } </code></pre> <p>then above how im iterating through the JSON result to draw a div on the page with images. The trouble im having is or course parsing the 'MainImg' binary data into a html image tag.</p> <p>Any ideas how i go about doing this?</p> <p>Any help would be greatly appreciated</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload