1
I need to process the feedback of the following code below. Remembering that it works correctly but, at some point, the search term does not exist returning "Undefined" and shows nothing on the screen. I need you to search for a locally saved default image right now. Thank you in advance.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script type="text/javascript">
$.ajax({
type: "GET",
url: "http://alvoparabusca.com.br",
data: {termo:"termo da busca",limitado:1,tipo:"imagem"},
success: function(data){
img = data["resultado"][0].imagem;
$("html").css({"background-image":"url("+ img +")"});
},
dataType: "jsonp"
});
</script>
if you give a console.log in.
data
what the result?– Marconi
When Undefined returns the Console returns: Object {resultCount: 0, Results: Array[0]}
– Emetec