Cross domain ajax request

Rahul_RJ picture Rahul_RJ · Mar 18, 2013 · Viewed 77.8k times · Source

I want to get the html respond page from the cross domain url.

for this I am using the ajax request as,

 $.ajax({
            type: 'GET',
            url: "http://wcidevapps.com/salescentral/idisk/0001000383/iDisk",
            dataType: "jsonp",
            success: function (response) {
                $(response).find('li a').each(function () {
                    listHref.push($(this).attr('href'));
                });

            }
        });

But after requesting it doesn't respond with any result back.

Answer

Abhisek Das picture Abhisek Das · Nov 3, 2014
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
  <script type="text/javascript">
    function NameAFunctionName() {
        $.ajax({
          url: 'http://wcidevapps.com/salescentral/idisk/0001000383/iDisk',
          type: 'GET',
          dataType: 'json',
          headers: {
            //WRITE IF THEIR HAVE SOME HEADER REQUEST OR DATA
          },
          crossDomain: true,
          success: function (data, textStatus, xhr) {
            console.log(data);
          },
          error: function (xhr, textStatus, errorThrown) {
            console.log(errorThrown);
          }
        });
    }   
</script>