Include OpenX ad in a jquery-ui dialog?

Posted by planetclaire on Stack Overflow See other posts from Stack Overflow or by planetclaire
Published on 2010-04-08T17:06:54Z Indexed on 2010/04/08 17:13 UTC
Read the original article Hit count: 570

I'm loading some content into a jquery-ui dialog via .ajax. That's all working fine but now I've been given an OpenX ad to embed into the dialog & can't figure out how to do it. I know all the script is stripped when coming in via ajax, & I know how to use $.getScript to load .js files for use in the dialog, but the OpenX ad script I've got uses document.write so I think it's expecting to be embedded inline into the desired position on the page.
I've tried appending the escaped script string into the div on ajax success of the main content as below, but this results in the page being redirected to a page with just the ad on it. Attempt shown below:

$("#" + idHelpPage).find(".adScript").append("<script type='text/javascript'>var m3_u = (location.protocol=='https:'?'https://d1.openx.org/ajs.php':'http://d1.openx.org/ajs.php');var m3_r = ... etc etc

I'm ok with jquery but not great with javascript, would really appreciate any help! Also if you want to see any other code.

© Stack Overflow or respective owner

Related posts about jquery-ui

Related posts about jquery-ajax