Having trouble with changing an img src's content through a JSON file.
HTML
<img id = "changePic" src ="" />
JQuery
-
- $(document).ready(function(){
- $.get("https://randomuser.me/api/", function(data, status){
- $('#changePic').attr("src", data.results[0].user.thumbnail);
- });
- });
Pretty much as topic says using the above JQuery function I have been unable to get the src to update to the url specified at data.results[0].user.thumbnail. Not really sure why it isn't so any help would be appreciated. Also, here is a
JSFiddle that corresponds to the current code.
Thanks.