user1142317
user1142317

Reputation: 583

Image display using javascript from a servlet response

I am trying to display a banner ad using this JS code

    document.write('<div><span><script type="text/javascript" \n\
src="http://localhost:8080/Adserver/adserver?id=' + pubcode +'><\/script></span></div>');

"http://localhost:8080/Adserver/adserver" is a servlet code which brings the image url as response. But I am still unable to render the image.

Any suggestions ?

Upvotes: 2

Views: 460

Answers (1)

Matthew Leffler
Matthew Leffler

Reputation: 1426

I think you're missing a closing quote for the image's src:

document.write('<div><span><script type="text/javascript" src="http://localhost:8080/Adserver/adserver?id=' + pubcode +'"><\/script></span></div>');

Upvotes: 4

Related Questions