Mike
Mike

Reputation: 617

jquery .load does not seem to work for me

Trying to use the jquery load() function but does not seem to work for me

$('#result').load('http://michaelschauffler.com/test.html', function(request, status, xhr){
     if (status == "error"){ // and it is
         // xhr.status is 0 and xhr.statusTest is error
         // then what is the error.
     }
});

This is not really what I am trying to do but I cannot seem to find out why thing dont seem to work for me like the examples I find. http://jsfiddle.net/webdevem/vxdHs/

So maybe there is something I am missing on my target page.

Upvotes: 0

Views: 33

Answers (2)

Aligator
Aligator

Reputation: 43

You forgot to write closing bracket of if condition.

please check below code.

 $(document).ready(function(){

 $('#result').load('http://michaelschauffler.com/test.html', function(request, status, xhr){

   if (status == "error"){ // and it is
     // xhr.status is 0 and xhr.statusTest is error
     // then what is the error.
   }

  });

});

Upvotes: 1

Mike
Mike

Reputation: 617

http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api

its because I am trying to access urls from outside my current domain...

Upvotes: 1

Related Questions