Ajax无法正常工作

I have this javascript

$('a[name=deleteButton]').on('click', function () {
    arr=[];
    var arr = $("input[name='post[]']:checked").map(function() { 
            return this.value; 
          }).get();
          var content = $(this).parents('tr').find('.key').html();
    $.ajax({
   type: "POST",
   data: {arr:arr},
   url: "../deleteRowUsingApiKey",
   success: function(results){
     alert(data);
   }
});
});

and in php

this is the codeigniter controller where I wanted to post the value

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
error_reporting(E_ALL);
ini_set('display_errors', 1);
class DeleteRowUsingApiKey extends CI_Controller
{
    function __construct()
    {
        parent::__construct();
    }

    function index()
    {
        // $this->load->model('deleteapi');
        // $this->deleteapi->deleteCheckout('CHECKvaPrfuRYzJa0MOUT');
        // echo "hi";
             echo $encrypted_data = $this->input->post('arr');

    }
}

The ajax is located inthe view and the php is in the controller folder,the codeigniter is installed in a folder app.Im not able to echo back the value in javascript,please help

The URL might be the problem.

You need to give the absolute URL in the JS function:

url: "<?php echo base_url(); ?>/deleteRowUsingApiKey",

If your ajax function is in a JS file, you need to define the base_url before including the JS, for e.g:

<script>var base_url = '<?php echo base_url(); ?>';</script>
<script src="path/to/the/ajax.js">

Now, you can access the base_url in the ajax.js, e.g:

url: base_url+"/deleteRowUsingApiKey",

Hope it helps.