I want to have a Javascript function load information for an image from an external text file, and display the image on my WordPress site. I found some code online to load and parse an external text file.
I haven’t been successful in getting it to work though.
I set up a separate html test page, but that’s not working either.
I’m trying to have the site load that js file, and output the image, using this code in the mmusic div:
document.write('<a href="' + AdLinkPath[0] + '" target="_blank"><img src="' + AdFilePath[0] + '" width="' + AdWidth[0] + '" height="' + AdHeight[0] + '"/></a>');
I tried the same code in the test.html file, and I haven’t been able to get it to work.
Can someone please tell me what I’m doing wrong?
Thanks!
The
document.writestatement is occurring before the AJAX response is received. If you move that statement directly after the fourreturnstatements it should solve your problem.