javascript - NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load -


i trying simple request flipkart search api.

  baseurl= 'https://affiliate-api.flipkart.net/affiliate/search/json?';   params={     query:name,     resultcount:5   };   var xhr=new xmlhttprequest();   xhr.open('get',baseurl+$.param(params),false);   xhr.setrequestheader("fk-affiliate-id","myidhere");   xhr.setrequestheader("fk-affiliate-token","mytokenhere");   xhr.send(); 

enter image description here after using asynchronous xmlhttprequest(),i following error:

var xhr = new xmlhttprequest();   xhr.open("get", baseurl+$.param(params), true);   xhr.onload = function (e) {     if (xhr.readystate === 4) {       if (xhr.status === 200) {         console.log("gowofee",xhr.responsetext);       } else {         console.error("gowofee",xhr.statustext);       }     }   };   xhr.onerror = function (e) {     console.error("gowofee",xhr.statustext);   };   xhr.setrequestheader("fk-affiliate-id","myid");   xhr.setrequestheader("fk-affiliate-token","mytoken");   xhr.send(null); 

now getting error: enter image description here


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -