How do I display AdSense in Ajax without iframes? $2

Discussion in 'Programming' started by mynameisdi, Jan 10, 2009.

  1. #1
    Hey,

    So I have an Ajax-powered website

    I currently display AdSense using iframes.

    I don't want to use iframes, is there a way around it?

    If I just copy/paste the code then it doesn't show anything at all.

    Need to work around it, so that the AdSense code would be IN THE PAGE itself and not in an iframe.

    Can anyone help? Will pay quick $2 via paypal.
     
    mynameisdi, Jan 10, 2009 IP
  2. atlantaazfinest

    atlantaazfinest Peon

    Messages:
    389
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    ill do it for u contact me via pm
     
    atlantaazfinest, Jan 10, 2009 IP
  3. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    put it in a <div>, and with css absolutely position it wherever you want :)
     
    ccoonen, Jan 10, 2009 IP
  4. manjifera

    manjifera Well-Known Member

    Messages:
    232
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    118
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    chk your PM for code!
     
    manjifera, Jan 10, 2009 IP
  5. mynameisdi

    mynameisdi Banned

    Messages:
    977
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #5
    Putting <div> code here </div> didn't help, still doesn't display anything

    And this code also doesn't help as it assumes that the ads are in a .php doc, I need the code to be on the page

    <script type="text/javascript">
    var http = false;

    if(navigator.appName == "Microsoft Internet Explorer") {
    http = new ActiveXObject("Microsoft.XMLHTTP");
    } else {
    http = new XMLHttpRequest();
    }



    function validate() {
    http.abort();
    http.open("GET", "ads.php", true);
    http.onreadystatechange=function() {
    if(http.readyState == 4) {
    document.getElementById('foo').innerHTML = http.responseText;
    }
    }
    http.send(null);
    }
    </script>

    <body Onload=validate()">

    <div id="foo">ad will get display here</div>
     
    mynameisdi, Jan 11, 2009 IP
  6. manjifera

    manjifera Well-Known Member

    Messages:
    232
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    118
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #6
    dont mind to share your page where you want to show the ads!! Because you need to assign div location inside your CSS! else its like hidden! somewhere at the end of page!!
     
    manjifera, Jan 11, 2009 IP
  7. mynameisdi

    mynameisdi Banned

    Messages:
    977
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #7
    mynameisdi, Jan 11, 2009 IP
  8. manjifera

    manjifera Well-Known Member

    Messages:
    232
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    118
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #8
    there is div named

    <div class="menuBody">
    <div class="tac"><img alt="morning" src="http://gotgame.lv/image.out?path=/gallery/large//3984"/>
    </div>
    <br>
    Add your code here so it will shows up below 1st picture!!
    </div>
    Edit these chages from contents are being fetched via ajax!!! i.e
    http://gotgame.lv//misc/site.js
    i guess this page!!
    http://gotgame.lv/ajax.php
     
    manjifera, Jan 11, 2009 IP
  9. mynameisdi

    mynameisdi Banned

    Messages:
    977
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #9
    What exactly do I have to edit there?
     
    mynameisdi, Jan 11, 2009 IP
  10. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #10
    Dont embed the adsense until page is loaded... so that adsense can "read" the content of your page... if it doesn't exist on the page yet, adsense can't figure out what ads to show up and won't show them!
     
    ccoonen, Jan 11, 2009 IP