2013-10-30 2 views
1
나는이 문제에 도움이 필요

..jQuery를 - 데이터의 검사가 처리 PHP로 전달된다

내가 jQuery를 함께 확인하고있어 양식 페이지가 다음 후 체크 박스 데이터 게시물 PHP의.

라디오 버튼에 문제가 있습니다.

누군가 나를 도와주세요, jQuery를 통해 어떻게 받아 들일 수 있습니까?

처음부터 끝까지 전체 결과가 필요합니다.

양식 : -이 데이터 싶습니다 -

<input type="checkbox" name="chk1" value="checkb1"/>Chk1 
<input type="checkbox" name="chk2" value="checkb2"/>Chk2 

<input type="checkbox" name="deliver[]" value="foreign"/>Foreign 
<input type="checkbox" name="deliver[]" value="internal"/>Internal 

<input type="radio" name="button" value="button1" >Button1 
<input type="radio" name="button" value="button2" >Button2 

JQuery와 :

jQuery(document).ready(function(){$('#submit').click(function() 

{ 
var cim=$('input[name=cim]'); 
var name=$('input[name=name]'); 
var message=$('textarea[name=message]'); 

if(name.val()==''){alert("Pls fill out");name.addClass('hightlight');document.adatform.name.focus();return false;}else name.removeClass('hightlight'); 

var data='cim='+cim.val() 
+'&name='+name.val() 
+'&message='+encodeURIComponent(message.val()); 

$('.contact input, .contact textarea').attr('disabled','true'); 
$('.loading').show();$.ajax({url:"../contact-form/send.php",type:"POST",data:data,cache:false,success:function(result){if(result == 'sent'){$('.contact-form').hide(600);$('.form-success').fadeIn('slow');}else alert('error, try later');} 
});return false;});}); 

가 감사를

+0

단순히 유 그냥 직렬화 그때의 양식 var str = ('form')과 같은 php 파일을 찾아라. serialize(); data = str 그리고 PHP unserialize ($ _ REQUEST) – Asif

답변

0

사용 serialize() 방법

$.ajax({ 
    url:"../contact-form/send.php", 
    type:"POST", 
    data:$('form').serialize(), 
    cache:false, 
    success:function(result){ 
     if(result == 'sent'){$('.contact-form').hide(600);$('.form-success').fadeIn('slow');}else alert('error, try later');} 
}); 
+0

작동! yesss! :) 네 - 네! :) – bluewin