| 제목 | ajax 로 보낸 값 ci Validation 체크문제 | ||
|---|---|---|---|
| 글쓴이 | 하하예에 | 작성시각 | 2016/01/13 14:37:37 |
|
|
|||
js 파일
$.ajax({
url: BASE+"/brd/ajax_ment_insert",
dataType: "json",
data: myForm,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function(obj) {
},
error:function(e){
alert(e.responseText);
}
});
controller
public function ajax_ment_insert() {
$a_prm = $this->input->post();
// Validation
$this->load->library('form_validation');
$this->form_validation->set_rules( 'v_ment_cont', 'v_ment_cont', 'required',
array('required' => '내용이 입력되지 않았습니다.'));
$this->form_validation->set_rules( 'v_ment_pwd', 'v_ment_pwd', 'required',
array('required' => '비밀번호 입력되지 않았습니다.'));
// Check
if ( $this->form_validation->run() == FALSE ) error_alert();
}
input <input type="text" id="v_ment_name" name="v_ment_cont" /> <input type="password" id="v_ment_pwd" name="v_ment_pwd" />
테스트할때는 post로 값이 잘 넘어가는걸 확인했습니다. 근데 값 없이 보내니 아무런 반응이 없는데 뭘 빠트린걸까요?
|
|||
| 다음글 | 500 에러 페이지를 커스텀 하고싶은데 방법이 있을까요... (1) | ||
| 이전글 | php5를 리눅스에 설치했는데요. (2) | ||
|
한대승(불의회상)
/
2016/01/13 14:43:27 /
추천
0
|
|
하하예에
/
2016/01/13 15:00:24 /
추천
0
감사합니다.ㅣ^^ |
|
닉
/
2016/01/13 17:03:14 /
추천
0
|
아무런 반응이 없는것이 맞습니다.
$this->input->post() 값이 null 인지 확인 하여 에러메시지를 출력 하도록 하시면 됩니다.