im pretty new to jquery and im writing a ajax ready comment box for my
community site. Im very new to javascript but got into frameworks
reading about javascript along the way and i wanted to know if im
going about my send function in the right fashion?

        function send(){

        var conf = new Array();

        var posting      = $('#Post_Comment').html('loading..');



        conf['commenttext'] = $.trim($('#commenttext').val());

        conf['UserID']      = $('#ID').val()

        conf['MediaID']     = $('#MediaID').val();

        conf['WriterID']    = $('#WriterID').val();

        conf['comment_v']   = $('#true').val();





        if(conf['commenttext'] == '' || conf['commenttext'] == null){

        $('#Post_Comment').html('Post Comment');

        $('#status').html('<div align="center" class="YourInfo">Please enter
some text</div>');

        setTimeout("$('#status').html('')",3000);

        return;

        }



        $.ajax({

        type: "POST",

        url: location.href,

        data: {

                "commentsubmit" : conf['comment_v'],

                "commenttext" : conf['commenttext'] ,

                "MediaID" : conf['MediaID'],

                "WriterID": conf['WriterID'],

                "ID" : conf['UserID']

                  },

        success: function(data){

        $('#Post_Comment').html('Post Comment');

    $.ajax({

                   type: "POST",

                   datatype: "json",

                   url: 'home/getcomments',

                   data: {

                             "ID" : conf['UserID'],

                                 "Type" : "Profile"

                                 },

                   success:function(json){
                   data = eval(json);

                   $('#commentdiv').html('' + data + '');

                   }

                   });



    }});



}

Reply via email to