This is a solution that I used on a Wordpress framework to incorporate ad locations into a responsive design.
In the real world I would highly recommend placing the ad code into a local .html file. Then call that by replacing the .html with .load (see comment in the code)