I need to handle the feedback of the following code below. Remembering that it works correctly however, at some point, the searched term does not exist returning "undefined" and does not show anything on the screen. I need you to look for a standard, locally saved image right now. Thank you in advance.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script><scripttype="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>