0

I've this code for tooltip on confirm button when first 2 users add a comment :

        $("#confirm").tooltip({
                    content: function(){
                                $.ajax({
                                    type: 'POST',
                                    url: '/comments/numUsers.json', 
                                    data: {draw_id : $("#PostId").attr('value')},
                                    dataType: 'json',
                                    success: function(data){

                                        onSuccess(data);

                                     },
                                    error: function(){
                                        return false;
                                    }

                                });

                                function onSuccess(data){
                                    if (data < 2){
                                        if(data == 0){
                                            return "You're the first user";
                                        }
                                        else{
                                            return "You're the second user";
                                        }

                                    }
                                    else{
                                        return false;
                                    }

                                }

                    }
                });

numUsers.json return the number of users which had already commented on the post. The ajax call work ad the "onSuccess" function was called correctly , but no Tooltip was shown on my button :-( any suggestions ? thx in advance

NikoDev
  • 15
  • 1
  • 9

0 Answers0