tags:

views:

44

answers:

2

for example the twitter follow button when pressed it sends an ajax call through php script and then displays unfollow:

how could that be acheived using jquery and css?

+1  A: 

I think you want jQuery UI, especially the button plugin: http://jqueryui.com/demos/button/

You can easily use it:

$('#my-button').button();
Yorirou
+1  A: 

Something like this:

$("#folow").click(function (){
     $.ajax(
     {
        type: "POST",
        url: "someAction.php",
        success: function(result) {
            $("#folow").val('unfolow');
            // do some more stuff
        }
     });
});

This will make the ajax call to an php action, and change the buttons text to something else when the ayax call is succesfull. In the php action you do the 'logic you need'.

for more info over tha ajaxcall see: http://api.jquery.com/jQuery.ajax/

bruno