Sophia Sutter
Sophia Sutter

Reputation: 43

Javascript Cross domain URL request

Is it possible to send the cross domain URL request and read the response using JSONP?

Could you please give me some samples?

I am trying to send URL request to a different domain using xhr but couldn't read the response

Please help

Thanks in Advance

Upvotes: 1

Views: 716

Answers (1)

user5340537
user5340537

Reputation:

You can check with blow example:

$(document).ready(function(){
$.ajax({ // ajax call starts
        //crossOrigin: true,
       type: "GET",
       url: 'http://www.google.com', // JQuery loads areas
       dataType: 'json', // Choosing a JSON datatype
       async: false,
       success: function(data) // Variable data contains the data we get from serverside
       {
        console.log(data);

       }
      });
});

Upvotes: 4

Related Questions