javascript - How to append the url to anchor tag inside a div which i got as a json response? -
i made ajax api , json response $.ajax({ url: 'http://api.yipit.com/v1/deals/key=tmbyhkzfcntmb&limit=20&division=boston', datatype: 'jsonp', success: function (data) { console.log(data); var = data.response.deals[0].business.url; // below url of page .htm extension console.log("link "+a); var mydiv = document.getelementbyid("empid"); var atag = document.createelement('a'); atag.setattribute('href', "what i'm supposed put here "); atag.innerhtml = "link text"; empid.appendchild(atag); } }); i have got value in a variable link , want use url in anchor tag. use atag.setattribute('href', a); a more appropriate way be $.ajax({ url: 'http://api.yipit.com/v1/deals/key=tmbyh...