1
양식이 있으며 ajax를 통해 제출하고 싶습니다. 그것은 게시하지만 양식 성공을 명확하게하지는 않습니다. 나는 또한 .done (함수)을 시도했다. 나는 또한 성공과 오류 (사고가 오류 여야 함)에 대한 경고 데이터를 시도했지만 아무 것도 경고하지 않습니다.ajax가 양식을 제출하지 않음
<?php echo CHtml::ajaxSubmitButton(
'Comment',
'review/ajaxComment',
array(
'type'=>'POST',
'dataType'=>'json',
'success'=>'js:function(data){
if(data.result==="success"){
document.getElementById("review-form").reset();
alert("this worked");
}else{
console.log(error)
}
}'
)
)?>
형태
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'review-form',
'enableAjaxValidation'=>true,
'clientOptions'=>array('validateOnSubmit'=>true),)); ?>
<?php echo $form->errorSummary($model); ?>
<div class="rating-row">
<?php $this->Widget('CStarRating', array(
'model'=>$model,
'attribute'=> 'star',
'minRating'=>.5 ,
'maxRating'=>5 ,
'starCount'=>5 ,
'ratingStepSize'=>.5
));?>
</div>
<div class="rating-row">
<label>Reviews</label>
<?php echo $form->textArea($model,'review'); ?>
<?php echo $form->error($model,'review'); ?>
</div>
양식 html을 게시 할 수 있습니까? – Dilish
꽤 직선적 인 형태입니다. – jaime
서버에서 어떤 응답을 얻습니까? –