After ajax image is outside the “ tag

Try this, with tags on .= '<a href=""https://wordpress.stackexchange.com/questions/227522/.get_permalink($id).""><img src="'.$image['url'].'" /></a>';