hamza765 hamza765 - 1 year ago 85
jQuery Question

How to send ajax request to external domain?

I have this AJAX request:

function getLinks(cn) {
url: cn,
error: function() {
success: function(data) {
return data;
type: 'get',
headers: {
'Access-Control-Allow-Origin': '*'

var insecure_links = getLinks(url);

but whenever I run it, it always scans for
instead of
(I just want the res to be the html of that page)

QUESTION: How do I modify this so that I can do a get request to a certain page and receive the HTML of that page back?

If it helps, I'm doing this on Nodejs.

Answer Source

You must be passing cn as google.com which may work in the browser bar but is not a valid url. Instead send cn as http://google.com

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download