Results 1 to 7 of 7

 

Thread: Javascript help required

  1. #1
    Leeky's Avatar
    Pagerank10.co.uk

    Status
    Offline
    Join Date
    Mar 2005
    Location
    uk
    Posts
    3,109
    Thanks
    225
    Thanked 185 Times in 126 Posts


    We are not familiar with js coding so require some help, at the moment we have the coding working but only if the .js file is called up from the same domain that the main coding is located on, but it just displays a blank page if called up from another domain... any ideas on what we have to do to get it working on any domain?

    Here is the .js file

    Code:
    subid = "eecca5b6365d9607ee5a9d336962c534";
    uname = "xmlsite";
    width = "100%";
    
    if (window.XMLHttpRequest)
      {
      xhttp=new XMLHttpRequest()
      }
    else
      {
      xhttp=new ActiveXObject("Microsoft.XMLHTTP")
      }
    xhttp.open("GET","feed_java.php",false);
    xhttp.send("");
    xmlDoc=xhttp.responseXML;
    
    title=xmlDoc.getElementsByTagName("title");
    voucher_code=xmlDoc.getElementsByTagName("voucher_code");
    affiliate_url=xmlDoc.getElementsByTagName("affiliate_url");
    merchant=xmlDoc.getElementsByTagName("merchant");
    document.write("<table width="+width+"><tr>");
    for (i=0;i<5;i++)
      {
      link=title[i].childNodes[0].nodeValue;
      url=affiliate_url[i].childNodes[0].nodeValue;
      document.write("<td width=20%><a target=_blank href="+url+">"+link+"</a>");
      document.write("<br />");
      document.write(voucher_code[i].childNodes[0].nodeValue);
      document.write("<br />");
      document.write(merchant[i].childNodes[0].nodeValue);
      document.write("</td>");
      }
      document.write("</tr></table>");
    Here is what we are using to call it up...

    Code:
    <script type="text/javascript"
      src="http://webservices.icodes.co.uk/test_ads5.js">
    </script>
    Here is the output from an external domain... (doesn't work)

    http://www.pagerank10.co.uk/test_ads5.html

    Here is the output from the domain also hosting the .js file and other main files (works fine)

    http://webservices.icodes.co.uk/test_ads5.html
    iCodes - Free Voucher and Offer API Available.

  2. #2
    futureweb's Avatar
    Registered User

    Status
    Offline
    Join Date
    Jul 2005
    Location
    North Devon
    Posts
    919
    Thanks
    13
    Thanked 22 Times in 22 Posts
    full url here at a guess m8 should fix it

    Code:
    xhttp.open("GET","feed_java.php",false);

  3. #3
    futureweb's Avatar
    Registered User

    Status
    Offline
    Join Date
    Jul 2005
    Location
    North Devon
    Posts
    919
    Thanks
    13
    Thanked 22 Times in 22 Posts
    Poo soz m8 looks like a security issue you can't do it

    Ext FAQ Ajax - Learn About the Ext JavaScript Library

  4. #4
    Registered User

    Status
    Offline
    Join Date
    Jun 2006
    Posts
    628
    Thanks
    7
    Thanked 70 Times in 67 Posts
    Quote Originally Posted by Leeky View Post
    We are not familiar with js coding so require some help, at the moment we have the coding working but only if the .js file is called up from the same domain that the main coding is located on, but it just displays a blank page if called up from another domain... any ideas on what we have to do to get it working on any domain?
    You can't do an xmlhttp cross domain - as you've probably realised :-)

    This might help
    JavaScript Developer Center : Use a Web Proxy for Cross-Domain XMLHttpRequest Calls - YDN

    Cheers,
    Jon

  5. The Following User Says Thank You to jonsp For This Useful Post:

    Leeky (30-10-09)

  6. #5
    Leeky's Avatar
    Pagerank10.co.uk

    Status
    Offline
    Join Date
    Mar 2005
    Location
    uk
    Posts
    3,109
    Thanks
    225
    Thanked 185 Times in 126 Posts
    We actualy had the full url in there orignally but still no luck... so we changed it to what you are seeing now.

    But just incase we tried the full url again and no joy!

    Could it be our server blocking something / setting needs altering, or just thought.. could it be anything to do with the files located on the sub domain (not sure why that should make a difference as the webservices works fine from it)

    Cheers

    Lee

    EDIT // Posted this at the same time other replies came in.. i'll go check out those links :-)
    iCodes - Free Voucher and Offer API Available.

  7. #6
    futureweb's Avatar
    Registered User

    Status
    Offline
    Join Date
    Jul 2005
    Location
    North Devon
    Posts
    919
    Thanks
    13
    Thanked 22 Times in 22 Posts
    its a browser security issue m8 not your server the browser blocks the request because it comes from a different domian.

    If I can think of a way for you to acheive the same result I will shout you.

  8. The Following User Says Thank You to futureweb For This Useful Post:

    Leeky (30-10-09)

  9. #7
    I'm not a celebrity...

    Status
    Offline
    Join Date
    Aug 2009
    Location
    The Jungle
    Posts
    622
    Thanks
    26
    Thanked 48 Times in 46 Posts
    ......forget that, just realised.

    (note to self - don't get involved in javascript conversations)



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. javascript help?
    By BFG 9000 in forum Programming
    Replies: 3
    Last Post: 21-01-09, 08:53 AM
  2. Javascript is here
    By Mogga in forum Commission Junction
    Replies: 6
    Last Post: 29-06-06, 10:21 AM
  3. Javascript enabled Browser check script required
    By DanielCoe in forum Programming
    Replies: 5
    Last Post: 18-11-05, 05:15 PM
  4. Javascript Help
    By pete1987 in forum Programming
    Replies: 1
    Last Post: 17-11-04, 04:08 PM
  5. Javascript Help
    By uklejon in forum Programming
    Replies: 2
    Last Post: 31-10-03, 04:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2