views:

12

answers:

0

Hey all, working on a client who needs a coupon to open in a new window when clicked, I think this code is just fine (the Ajax is working and returning a URL), but, I get nothing when I click:

<a href="#" onclick="do_ajax(); return false;">
<img src="http://www.blah.com/fb/getcouponimage.jpg" alt="" width="169" height="47" border="0">
</a>

<script type="text/javascript">
function do_ajax() {
  var ajax = new Ajax();
  ajax.responseType = Ajax.RAW;
  ajax.ondone = function(data) {
    window.open(data, 'popupwindow', 'scrollbars=yes,width=550,height=520'); 
  }

  var postUrl = 'SCRIPT THAT OUTPUTS URL AS STRING';
  ajax.post(postUrl);
}
</script>

<div id="myDiv"></div>

Any ideas? This seems like it should be working.