Yii Framework Forum: get server side response from ajax button - Yii Framework Forum

Jump to content

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

get server side response from ajax button Rate Topic: -----

#1 User is offline   ps_sach 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 82
  • Joined: 07-December 09

Posted 26 March 2010 - 01:31 AM

Hi there,

I have ajax submit button. After submitting the form, response from server is updating a div which is given as update parameter in ajax array.

Now what I want is to catch the response in the javascript instead of updating div. Meaning I want to call a javascript function on success or complete and want to get the response in the javascript veriable.


How I can do that ?
Plz help me out.

Thanks in advance.
0

#2 User is offline   Matt Kelliher 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 12-February 10
  • Location:Tampa, FL

Posted 26 March 2010 - 10:46 AM

Instead of using the 'update' parameter, set 'success' to be a function like so:

CHtml::ajaxButton($label, $url, array(
    'type'=>'POST',
    'success'=>'function(msg) { window.alert(msg); }',
  )
);

1

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