小编lea*_*eed的帖子

Jquery验证自定义错误消息位置

这看起来非常简单,但我无法弄清楚.我正在使用jquery validate插件.我正在尝试验证<input name=first>并将<input name=second>错误消息输出到:

<span id="errNm2"></span> <span id="errNm1"></span>
Run Code Online (Sandbox Code Playgroud)

我已经开始编写errorPlacement:您可以在其中自定义错误消息位置.

如何将错误消息放入其中<span>

$(document).ready(function () {
    $('#form').validate({
        errorPlacement: function(error, element) {
            error.append($('.errorTxt span'));
        },
        rules,
});
Run Code Online (Sandbox Code Playgroud)
<input type="text" name="first"/>
<input type="text" name="second"/>

<div class="errorTxt">
   <span id="errNm2"></span>
   <span id="errNm1"></span>
</div>
Run Code Online (Sandbox Code Playgroud)

html jquery jquery-validate

33
推荐指数
2
解决办法
11万
查看次数

Laravel使用ajax将数据传递给控制器

如何将此ajax调用中的id传递给TestController getAjax()函数?当我进行调用时,url是testUrl?id = 1

Route::get('testUrl', 'TestController@getAjax');

<script>
    $(function(){
       $('#button').click(function() {
            $.ajax({
                url: 'testUrl',
                type: 'GET',
                data: { id: 1 },
                success: function(response)
                {
                    $('#something').html(response);
                }
            });
       });
    });    
</script>
Run Code Online (Sandbox Code Playgroud)

TestController.php

public function getAjax()
{
    $id = $_POST['id'];
    $test = new TestModel();
    $result = $test->getData($id);

    foreach($result as $row)
    {
        $html =
              '<tr>
                 <td>' . $row->name . '</td>' .
                 '<td>' . $row->address . '</td>' .
                 '<td>' . $row->age . '</td>' .
              '</tr>';
    }
    return $html;
}
Run Code Online (Sandbox Code Playgroud)

ajax routes laravel

9
推荐指数
2
解决办法
4万
查看次数

如何在PHP中将Unicode转义序列转换为文本?

我有这个Unicode序列:\u304a\u306f\u3088\u3046\u3054\u3056\u3044\u307e\u3059.如何将其转换为文本?

$unicode = '\u304a\u306f\u3088\u3046\u3054\u3056\u3044\u307e\u3059';
Run Code Online (Sandbox Code Playgroud)

我试过了:

echo $utf8-decode(unicode);
Run Code Online (Sandbox Code Playgroud)

我试过了:

echo mb_convert_encoding($unicode , 'US-ASCII', 'UTF-8');
Run Code Online (Sandbox Code Playgroud)

我试过了:

echo htmlentities($unicode , ENT_COMPAT, "UTF-8");
Run Code Online (Sandbox Code Playgroud)

但这些函数都不会将序列转换为相应的日文文本.

php unicode unicode-escapes

4
推荐指数
2
解决办法
3789
查看次数

id和name在表单中做什么?

提交表单时,表单会同时查找“名称”和“ id”值吗?除了使用CSS设置样式外,“ id”还有什么作用?

<select name="combobox" id="combobox">
   <option value="0">Inactive</option>
   <option value="1">Active</option>
</select>
Run Code Online (Sandbox Code Playgroud)

html forms

1
推荐指数
1
解决办法
4697
查看次数

标签 统计

html ×2

ajax ×1

forms ×1

jquery ×1

jquery-validate ×1

laravel ×1

php ×1

routes ×1

unicode ×1

unicode-escapes ×1