2017. 6. 23. 13:56

jquery validate ajax form submit 2가지 방법

1. validate 의 submitHandler 를 사용하는 방법

$('#form-id').validate({
    rules : { ... },
    submitHandler: function(f) {
        $.ajax(
            url: f.action,
            type: f.method,
            data: $(f).serialize(),
            success: function(response) {
                alert(response);
            }
        );
    }
});

2. jquery 의 ajaxForm을 사용하는 방법

$('#form-id').ajaxForm({
    beforeSubmit: function() {
        $('#form-id').validate({......});
        return $('#form-id').valid();
    },
    success: function(response) {
        alert(response);
    }
});



2017. 6. 7. 14:54

rewrite 리라이트룰

<IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule  ^/([a-zA-Z0-9\_]+)/?$ /home/계정/public_html/index.php?d=$1&f=index    [L,QSA]
        RewriteRule  ^/([a-zA-Z0-9\_]+)/([a-zA-Z0-9\_]+)/?$ /home/계정/public_html/index.php?d=$1&f=$2    [L,QSA]
        RewriteRule  ^/([a-zA-Z0-9\_]+)/([a-zA-Z0-9\_]+)/([a-zA-Z0-9\_]+)/?$ /home/계정/public_html/index.php?d=$1&f=$2&p=$3    [L,QSA]
    </IfModule>


http://도메인/d/f/p -> /index.php?d=d&f=f&p=p

2017. 5. 11. 16:28

[PHP] MySQL 모든 테이블에서 특정 필드 존재하는지 확인 후 특정 작업하기

m_idx 라는 필드를 가지는 테이블에서 특정 레코드값을 다른 db로 그대로 옮기는 작업, 여러가지로 응용 가능할 것임


2017. 3. 2. 16:48

zsh 또는 oh-my-zsh 사용 시 Home/End 키 동작안될때

1. zsh 설치되었는지 확인하고 yum등으로 설치


cat /etc/shells #설치된 쉘 목록 확인


echo $SHELL #현재쉘 확인


which zsh # 또는 whereis zsh 로 경로 확인


chsh -s /bin/zsh #기본쉘 변경 또는 /etc/passwd 파일에서 변경하고 재접속해도 됨



2. oh-my-zsh 설치

curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh


3. /계정/.zshrc 에 아래 내용을 추가


#Rebind HOME and END to do the decent thing:
bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line
case $TERM in (xterm*)
bindkey '\eOH' beginning-of-line
bindkey '\eOF' end-of-line
esac

#To discover what keycode is being sent, hit ^v
#and then the key you want to test.

#And DEL too, as well as PGDN and insert:
bindkey '\e[3~' delete-char
bindkey '\e[6~' end-of-history
bindkey '\e[2~' redisplay

#Now bind pgup to paste the last word of the last command,
bindkey '\e[5~' insert-last-word