在javascript中加载静态文件

时间:2017-02-23 10:33:09

标签: javascript python html django

如果服务器中的图像不可用,我试图显示默认图像。 business.profilePic是从服务器onerror动态加载的,我想显示静态文件夹中的图像

cell1.innerHTML = '{% load static %}<img class="img-responsive" 
src=' + business.profilePic + 'width="60" onerror="this.onerror = null; 
this.src={% static search/GoCheck_Logo.png %}" height="80" alt="Logo">';

在html正文中,{% load static %}工作正常,但在javascript我不知道该怎么做

0 个答案:

没有答案