I am calling a javascript function (function test()) which calls a url which returns a html script. I want to render that on to the page.
I am using this, but when I go to view source I am not seeing any image..
function test()
{
document.write('<SCR'+'IPT SRC="http://demoweb.com/renderimage;type=a;num='+ 1000 +'?" type="text/javascript"></SCR'+'IPT>');
}
This retuns URL http://demoweb.com/renderimage;type=a;num=1000? (if I paste it in browser)
document.write("<img src='http://demoweb/?ct=0:abg22&adv=43nn3gg&fmt=2' width='1' height='1' border='0'/>");
A browser’s View Source shows the HTML as-downloaded from the server, not the page’s DOM after any scripts have run. For that you’d use a DOM browser, such as Firefox’s DOM Inspector or Firebug, or IE’s Developer Tools.
Use of
document.writeis not recommended because it causes a re-parse of the document. It’s better to use DOM manipulation methods instead.Try this: