in jQuery I use this code but this show nothing to me what is there error in this code
// $.ajax({
// URL:"https://dog.ceo/api/breeds/image/random",
// method:"GET",
// success:function(data){
// var myurl=data.message;
// $("#dog-image").attr("src",myurl);
// }
// });
The property, URL, should be lowercase, url, per the documentation.
$.ajax({
url: "https://dog.ceo/api/breeds/image/random",
method: "GET",
success: function(data) {
var myurl = data.message;
$("#dog-image").attr("src", myurl);
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<img id="dog-image" />