Site icon Hip-Hop Website Design and Development

I want to load post content by categories using Ajax

I have question.
I would like to load post content, custom post, depends on category.
So first of all I would like to have drop down menu which will list all my categories then once user will select category list of post title will appear in second drop down (post from that particular category) then once that title selected post content will load. All that needs to be done on one page and without reloading so using Ajax. I stacked at the very beginning

<script type="text/javascript">
$(function(){
            $('#main_cat').change(function(){
                    var $mainCat=$('#main_cat').val();

                    // call ajax
                     $("#sub_cat").empty();
                        $.ajax({
                            url:"/wp-admin/admin-ajax.php",
                            type:'POST',
                                                        data:'action=my_special_action&main_catid=' + $mainCat,

                             success:function(results)
                                 {
                                //  alert(results);
                $("#sub_cat").removeAttr("style");
                $("#sub_cat").append(results);
                                        }
                                   });
                          }
                                    );
});
</script>

And I found that bit which was inserted into function.php and I do realize that that needs to be modified somehow to pull out posts rather then children of categories

add_action('wp_ajax_my_special_action', 'my_action_callback');
add_action('wp_ajax_nopriv_my_special_action', 'my_action_callback');
function implement_ajax() {
if(isset($_POST['main_catid']))
            {
            $categories=  get_term_by('child_of='.$_POST['main_catid'].'&hide_empty=0');
              foreach ($categories as $cat) {
                $option .= '<option value="'.$cat->term_id.'">';
                $option .= $cat->term_id;
                $option .= ' ('.$cat->category_count.')';
                $option .= '</option>';
              }

              echo '<option value="-1" selected="selected">Scegli...</option>'.$option;
            die();
            } // end if
}
add_action('wp_ajax_my_special_ajax_call', 'implement_ajax');
add_action('wp_ajax_nopriv_my_special_ajax_call', 'implement_ajax');//for users that are not logged in.

Thats as far as i got.
Any help will be appreciated