【发布时间】:2013-10-05 04:12:32
【问题描述】:
我正在尝试使用 Jquery Validator 验证 laravel 4 中的表单,我唯一无法执行的操作是远程验证电子邮件。
我用我的浏览器尝试了以下
http://example.com/validacion/email/info@info.com
我得到了我想要的结果(在 json 中)。
//Routes.php
Route::get('validacion/email/{email}', 'ValidatorController@getValidacionEmail');
//In my JS the rule of email is
email: {
required: true,
email: true,
remote: {
url: "/validacion/email/",
type: "get",
data: {
email: "akatcheroff@gmail.com"
},
complete: function(data) {
if (data.responseText !== "true") {
alert(data.respuesta);
}
}
}
当我使用 Firebug 时,我得到了这个位置
http://example.com/validacion/email/?email=akatcheroff%40gmail.com
和一个 301 代码,然后是一个 500 和这个错误
{"error":{"type":"Symfony\Component\HttpKernel\Exception\NotFoundHttpException","message":"","file":"C:\Users\Usuario\Dropbox\Public\sitios\ futbol\vendor\laravel\framework\src\Illuminate\Routing\Router.php","line":1429}}
有人知道是否有办法以路由识别的方式发送我的邮件参数吗?
谢谢!
【问题讨论】:
-
尝试删除 ajax url
url: "/validacion/email",末尾的斜杠并删除路由上的{email}参数。