I am doing a cross-site ajax to java data transaction(Not sure if I named that correctly, so please forgive me about that). Part of code in Java file:

BufferedReader input =
            new BufferedReader(new InputStreamReader(connectionsocket.
DataOutputStream output =
            new DataOutputStream(connectionsocket.getOutputStream());
output.writeChars("some random text");

Also I have index.php file with some jQuery:

                type: 'get',
                dataType: 'xml',
                url: 'http://localhost:1024/'+$("#command").val(),
                success: function(data) {console.log(data);},
            error: function() { console.log("Error"); }

The command is sent correctly and received in Java side correctly. Then the request from java to ajax is 200 OK too. The output is also working. (For example if I remove output.close(), I do see in the firebug, that it is waiting for the output to be closed.)

The only problem is, no matter what I do I get no response text. It's always an empty string :(

P.S. I made a mistake while writing here (because it was that I was trying everything I could think of), it has to be

dataType: 'text',

, but still, that doesnt solve the problem