Yii Framework Forum: Chtml::ajaxsubmitbutton - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Chtml::ajaxsubmitbutton how to use this Rate Topic: -----

#1 User is offline   rajesh chaurasia 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 12-January 13
  • Location:Mohali

Posted 20 March 2013 - 11:10 PM

i am using in my code
<?php echo CHtml::ajaxSubmitButton($model->isNewRecord ? 'Send' : 'Send',
CHtml::normalizeUrl(array("user/send")),
//'#',
array('id'=>$model->id ,
'success'=>'function(html){ $("#box").attr("value", ""); }',
'url' => Yii::app()->createUrl("user/send"),),
array('class'=>"btn btn-primary")); ?>

is there is any mistake in my code .
0

#2 User is offline   Balu 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 153
  • Joined: 09-August 11
  • Location:Kerala, India

Posted 21 March 2013 - 12:18 AM

<?php
echo CHtml::ajaxSubmitButton('Save','your-url',array(
   'type'=>'POST',
   'dataType'=>'json',
   'success'=>'js:function(data){
       if(data.result==='success'){
          // do something on success, like redirect
       }else{
         $('#some-container').html(data.msg);
       }
   }',
));
?>



compare with this
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users