function codes() { url = '/captcha/refresh?' + Math.random() $.get(url, function (result) { console.log(result.image_url) $('img[class="captcha"]').attr('src', result.image_url) $('#id_captcha_0').attr('value', result.key) }) } $('img[class="captcha"]').mousedown(function () { console.log('备点了') codes() })
须要包 1. pip install django-simple-captcha 目前安装的是0.3.4版本。 手工下载能够安装 0.3.6最新版。javascript