Unexpected identifier after performing an event in query-Collection of common programming errors

Hello guys I have a problem in getting textboxes inputs in my jquery using ID. Ok here’s my code.



            var globalBase_Url = "{$base_url}"; //OK NO ERROR   
            var name = "";
            var desc = "";

            {literal}

                $(document).ready(function(){

                    $('#add_cat').on('click',function(){
                        $('#add_category').show('slide');
                    });

                    $('#submit').on('click',function(){

                        jquery.ajax({ 

                            var name = $('#category_name').val(); //this is the error
                            var desc = $('#description').val(); // this is the error

                        });

                    });

                });

            {/literal}


        

....


            
CATEGORY NAME:
DESCRIPTION:

As you have seen above. My error is the variables. I don’t know why. Please help me guys thanks.