使用jQuery AJAX发送JSON

Why isn't this PHP getting my links array?

function check_links() {

        $matches = $this->input->get('links');


        if($matches == true) {
            echo json_encode('matches is true');
        } else {
            echo json_encode('matches is false');
        } 


        //echo json_encode($matches);

    }

The JS

        var linksStr = $("#links").val();
        var matches = linksStr.match(/\bhttps?:\/\/[^\s]+/gi);

        alert(matches.length);

        for(var i = 0; i < matches.length; i++) {
            alert(matches[i]);
        }

        var links = JSON.stringify(matches);

        $.ajax({
        type: 'GET',
        dataType: 'json',
        cache: false,
        data: links,
        url: 'publishlinks/check_links',
        success:                    
            function(response) {

                alert(response);

            }


        })

I'm confused a bit with what is trying to be achieved here.
But the JSON.stringify needs to be assigned to a value,

var links = JSON.stringify(matches);

like links

var links = 'links='+JSON.stringify(matches);

Then in your function, $matches should now contain your json-encoded links.
So you can use that,

function check_links() {
  $matches = $this->input->get('links');
  ...
  $matches = json_decode($matches); // do stuff
  ....