$ .post函数在jquery中为ajax请求重复url

I am trying to make an ajax request with $.post function using jquery. It's repeating the url. If I just type direct url in $.post('http://url') it works fine.

$(document).ready(function(){

      $('#btnSubmit').on('click', function(e){

                    e.preventDefault();

    var name = $('#name').val();

    var url = "'"+'<?php echo base_url();?>'+"'";   

    console.log(url);

    $.post(url,
    {
      name: name
    },
    function(data,status){
        console.log("Data: " + data + "
Status: " + status);
    });
      });  
  });

result I am getting in console

  "http://localhost:8080/mysite/'localhost:8080/mysite/'"

You can use jquery to get the base url:

window.location.host + "/"