【发布时间】:2016-01-22 15:05:35
【问题描述】:
用途:刷新验证码图片。
routes.php
Route::get('/get_captcha/{config?}', function (\Mews\Captcha\Captcha $captcha, $config = 'default') {
return $captcha->src($config);
});
验证码图片(mypage.blade.php):
<img src="{{ Captcha::img() }}" alt="captcha" class="captcha-img" data-refresh-config="default">
js文件:
$(document).ready(function(){
$('img.captcha-img').on('click', function () {
var captcha = $(this);
var config = captcha.data('refresh-config');
//console.log(config);
$.ajax({
method: 'GET',
url: '/get_captcha/' + config,
}).done(function (response) {
captcha.prop('src', response);
});
});
});
问题: 我的控制台上的 js ajax 错误:http://localhost/get_captcha/default 404 错误。
参考:https://github.com/mewebstudio/captcha/issues/54#issuecomment-141483501
附加信息:我正在为 Laravel 4 使用验证码,但在 $captcha->src($config) 上面的行中我找不到名为 src 的方法
提前谢谢你。
【问题讨论】:
标签: php jquery ajax laravel-4 captcha