0

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.
            getInputStream()));
DataOutputStream output =
            new DataOutputStream(connectionsocket.getOutputStream());
...
output.writeChars("some random text");
output.close();

Also I have index.php file with some jQuery:

$(document).ready(function() 
    {
        $("#send_data").click(function(){
            $.ajax({
                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 :(

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by kolibrizas
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.