小编Cha*_*ell的帖子

Jquery Validate Remote失败.无法提交表格

我曾经使用过工作表单验证,包括远程检查用户名.我们已经在script.js文件中添加了很多其他的javascript,并且在最近的某个时候,它的远程部分已经破坏了.validate,new_name字段只检查一个表单字段.它是必需的(工作)并且必须可用(不起作用).

这是jQuery:

        $('#nickname_form').validate({
        rules: {
            new_name: {
                required: true,
                remote: {
                    url: '/api/screenname_unique/',
                    type: 'post'
                }
            }
        },
        messages: {
            new_name: {
                required: 'Please choose a Forum Username.',
                remote: 'That Username is already taken or contains invalid characters.'
            }
        }
    });
Run Code Online (Sandbox Code Playgroud)

正如我所说,以上用于工作,没有任何变化.我已经检查了script.js文件的其余部分并且没有出现任何错误.此外,在网站中,我们没有在任何地方看到JS错误.如果我删除上述代码的远程部分,则所需的检查工作,并且当字段中有值时,表单将提交.

如果远程到位,表单将不会提交,并且远程调用的ajax响应是真还是假,则不会显示jQuery validate错误消息.这是remote调用的页面.就它给定给定值的响应而言,它工作得很好:

<?php
header('Content-type: application/json');

//get the post value
$screen_name = $_POST['new_name'];

//get their member_id
$member_id = $this->EE->session->userdata['member_id'];

//return false if no screen_name provided
if((!$screen_name) || (!$member_id)) {
    echo json_encode(false);
    exit;
} else { //there is a screen_name …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-validate

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

帮我从多维PHP数组中获取一个值

我似乎无法获得这个价值.这是数组:

[1596] => Array
(
    [entry_id] => 1596
    [title] => This is the article title
    [url_title] => url-title-here
    [status] => open
    [entry_date] => 1304544513
    [alt_title] => 
    [article_summary] => This is the article summary
    [article_intro] => This is the article intro
    [article_image] => 
    [article_body] => This is the article body
    [article_media_id] => 1
    [article_videos] => 
    [article_media] => Array
        (
            [0] => Array
                (
                    [row_id] => 3730
                    [row_order] => 0
                    [col_id_7] => image
                    [col_id_12] => right
                    [col_id_8] => 9781400068609.jpg
                    [col_id_9] => 
                    [col_id_10] …
Run Code Online (Sandbox Code Playgroud)

php arrays multidimensional-array

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

MediaTemple上的ExpressionEngine - 删除index.php会导致"未指定输入文件"

我有一个带有标准ExpressionEngine htaccess代码的MT站点,用于删除index.php并且主页可以工作,如果我将index.php放在URL中,所有其他页面都可以工作.没有它,我得到"没有指定输出文件".它适用于我的本地和非MT服务器,所以我知道它是一个环境的东西.需要更改htaccess中的哪些内容才能使其在MT上运行?

<IfModule mod_rewrite.c>

# Enable Rewrite Engine
# ------------------------------
RewriteEngine On
RewriteBase /


# Use Dynamic robots.txt file
# ------------------------------
RewriteRule robots\.txt /robots.php [L]


# Redirect index.php Requests
# ------------------------------
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{THE_REQUEST} !/admin/.*
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]


# Standard ExpressionEngine Rewrite
# ------------------------------
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

</IfModule>
Run Code Online (Sandbox Code Playgroud)

mediatemple expressionengine

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