javascript - display image using jquery and ajax -


to display company details image, have controller like:

public jsonresult printheading()         {             companymodel cm = new companymodel();             string qry = "select companyname,address,contactno,emailaddress,logofilename tblcompanyinfo";             datatable dt = cls.loaddata(qry);             foreach (datarow dr in dt.rows)             {                         cm.companyname = convert.tostring(dr["companyname"]);                         cm.address = convert.tostring(dr["address"]);                         cm.contactno = convert.tostring(dr["contactno"]);                         cm.emailaddress = convert.tostring(dr["emailaddress"]);                         cm.logofilename = path.combine("\\content\\logo", convert.tostring(dr["logofilename"]));             }             return json(cm, jsonrequestbehavior.allowget);         } 

and function:

function getprintheading() {        var heading = '';        $.ajax({            url: '@url.content("~/bank/printheading")',            type: "get",            datatype: "json",            async: false,            success: function (headdata) {                heading = '<img src="' + headdata.logofilename + '" width=50 height=50>' + headdata.companyname + '<br>' + headdata.address + '<br>' + headdata.contactno + ', ' + headdata.emailaddress ;            }        });        return heading;                       } 

it displays other data doesn't display image.please can give idea?

i think forgot close img tag.check once may you.

<img src="' + headdata.logofilename + '" width=50 height=50 /> 

Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -