Is There Any Very Simple Sample Of Ajax On Yii?

I try to follow the guide from yii wiki about ajax and javascript. Unfortunately, it is too complex to understand or able to run. Anyone has another sample that able to perform ajax + javascript on yii please send me ones, thank :).

What I want is client-side send to test.php a variable aValue. It process and send back $responseData to client-side, then from there it will execute callback function if the data successfully passed: aFunction(responseData).

Using directly jquery:

http://api.jquery.com/jQuery.ajax/

Can anyone explain to about these codes:




$.ajax({

type: "POST",

url: "some.php",

data: { name: "John", location: "Boston" }

}).done(function( msg ) {

alert( "Data Saved: " + msg );

});



If I have 2 buttons, how do I know which one I pressed? How to set get or post method for these buttons? And variable msg is the response data from server-side? Can I run only? :


.done(aFunction(document.getElementById("divID").value));

Which means not want to use response message.

Please start learning jquery because in this way you will get nowhere.

However:




$('#button-1').on("click", function(){

 var promise = $.ajax({

    type: "POST",

    url: "some.php",

    data: { name: "John", location: "Boston" }

 }); 

 promise.done(function(serverResponse){

    // do something with serverResponse here

 });

 return false;

});



same applies for #button-2, etc…

Thank, it helps a lot :)

http://www.yiiplayground.com/index.php?r=AjaxModule/ajax/ajaxRequest