Results 1 to 2 of 2
  1. #1
    Member Cav's Avatar
    Join Date
    August 13th, 2008
    Location
    Ontario, Canada
    Posts
    98
    Trouble with Linkshare API
    linkshare API, server says status of 200 and readyState of 4 but responseXML an responseText is null? When I try a local file on my server it works fine, and when I use the url with my token and paste it into the address bar in my browser it gives my the queried result in XML format. I'm not sure why it is not working in my code.

    Code:
     
    <script type="text/javascript">
    			//constructor function for an XML request object;
    		function XMLDoc() {
    			var me = this;
    			var req = null;
    			//branch for native XMLHttpRequest object
    			if (window.XMLHttpRequest){
    				try{
    					req = new XMLHttpRequest();
    					}catch(e) {
    					req = null;
    					}
    			//branch for IE/Windows ActiveX versions 
    		}else if (window.ActiveXObject) {
    				try{
    					req = new ActiveXObject("Msxml2.XMLHTTP");
    					}catch(e){
    				try{
    					req = new ActiveXObject("Microsoft.XMLHTTP");
    					}catch(e) {
    					req = null;
    				}
    			}
    			  }else {
    					alert("This page requires a browser with XML support");
    					}
    					//preserve reference to request object for later
    					this.request = req;
    					//"public" method to be invoked whenever
    					this.loadXMLDoc = function(url, loadHandler) {
    					if (this.request) {
    					this.request.open("GET", url, true);
    					this.request.onreadystatechange = function () {loadHandler(me)};
    					this.request.setRequestHeader("Content-Type", "text/xml");
    					this.request.send("");
    					}
    				};
    			}
    			
    					//Now creating an instance of the XMLDoc object
    					function initXML() {
    						var productQuery = new XMLDoc();
    						
    
    						productQuery.loadXMLDoc("http://feed.linksynergy.com/productsearch?token=MYTOKEN&keyword=%22KEYWORD%20&cat=%22MYCAT%22&MaxResults=20&pagenumber=1&mid=MERCHANTID", showProductQue);
    					}
    					
    				function showProductQue(req){
    					
    					
    					req = req.request;
    					if (req.readyState == 4 && req.status == 200){
    						var xDoc = req.responseXML;
    				
    					}
    			}
    
    	//window.onload = function() {initXML();}
    			
    </script>

  2. #2
    Member Cav's Avatar
    Join Date
    August 13th, 2008
    Location
    Ontario, Canada
    Posts
    98
    Never mind, I figured this one out, it's because of the same origin policy...DUHHH!!,lol

  3. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Linkshare API help?
    By kmnmediallc in forum Rakuten LinkShare - LS
    Replies: 2
    Last Post: February 9th, 2012, 10:35 AM
  2. LinkShare Merchandiser API
    By mikemad in forum Rakuten LinkShare - LS
    Replies: 0
    Last Post: October 21st, 2009, 01:30 AM
  3. Trying out linkshare Query API
    By Cav in forum Programming / Datafeeds / Tools
    Replies: 0
    Last Post: July 28th, 2009, 11:07 PM
  4. Trouble logging into linkshare
    By JennyM in forum Rakuten LinkShare - LS
    Replies: 5
    Last Post: December 13th, 2005, 07:26 PM
  5. Trouble Connecting To Linkshare
    By phil.davis@deepdiscounts.com in forum Rakuten LinkShare - LS
    Replies: 3
    Last Post: May 9th, 2004, 07:16 AM

Posting Permissions

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