How to check content in URL (Javascript)

I have urls in json channel n, each url contains one image. I want to check those URLs that have an image or not (NULL). How to check this with javascript. since I'm new, I don’t know how to confirm this. thank

      JSON feed with image n NULL
        {

         previewImage:"http://123.201.137.238:6060/feed/videoplay/Jackie.png",

        }, 
        {

        previewImage:"http://www.snovabits.net/feed/ImageMI/WarCraft.jpg",

        },
+5
source share
2 answers

Interest Ask!

div ( jQuery, div display: none;).
( setInterval), . -, setInterval .

img Chrome Firefox:

naturalHeight != 0

img IE7,8,9:

fileCreatedDate != ''

, .

, , 10 . !:
http://jsfiddle.net/xGmdP/

Chrome FF - setInterval, . , , IE ( IE , ).

, :

<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.min.js" type="text/JavaScript"></script>
  <script type="text/JavaScript">
    $(function(){
      $('#images').prepend('<img id="img1" src="http://123.201.137.238:6060/feed/videoplay/Jackie.png">')
      $('#images').prepend('<img id="img2" src="http://www.snovabits.net/feed/ImageMI/WarCraft.jpg">')
      setInterval(test, 10);
    })

    function test(){
      var props=['naturalHeight', 'complete', 'fileCreatedDate', 'clientHeight', 'offsetHeight', 'nameProp', 'sourceIndex'];
      for(i in props){
        var pr = props[i];
        $('#testresults').append('1:'+pr+' = ' + $('#img1').prop(pr)+'<br>');
        $('#testresults').append('2:'+pr+' = ' + $('#img2').prop(pr)+'<br>');
      }
      $('#testresults').append('---<br>');
    }
  </script>
</head>
<body>
  <div id="images"><div>
  <div id="testresults"></div>
</body>
</html>
+1

, , if(previewImage == "") { /* image is null, do stuff */ }, , , GET AJAX HTTP-, : (jQuery):

$.ajax({
    url: "http://123.201.137.238:6060/feed/videoplay/Jackie.png",
    cache: false,
    error: function(){
       alert("image doesn't exist!");
    }
});

"" , .

0

All Articles