传递变量$ .ajax调用

I want to pass js variables to an $.ajax function, like:

function myCall(elm) {
    var table = $('#realtime').dataTable(); 
    var extension = $(elm).closest("tr").find('td.extension').text();
    var agent = $(elm).closest("tr").find('td.name').text();
    alert(extension);

    $.ajax("/cura/pages/realtime/test.php/",{
        type: "GET",
        data:   {action:'agentpause',pauselocation: extension,queue: 'testq',paused: 'true'}            
    });
}

Only extension is a variable, rest hard coded. Then it doesn't work. If i hard code the value for extension variable, then the $.ajax call is successful. What's going wrong with passing extension variable?

There was a whitespace added in front of the variable value, in the table. Removing the white space in $.ajax function with trim(), like:

(extension.trim())

Now the $.ajax call is successful.