I'm writing a google-chrome extension, that must make ajax demands to some server, send some data, and receive some data back. My server is Tomcat 6., running on localhost.

I can receive all of the data around the server side, do all of the proccessing i want, and send an answer to the extension, however the status i recieve within the callback is , and responseText="".
my prediction would be that the problem lies in both the server - coming back an answer to some requset coming initially from from chrome-extension://... url, or perhaps in the extension - getting a response from localhost:8080.
any ideas? i'd really appreciate if a person knows the answere for this.

I have discover the problem for a few hrs - I have set the neccessary permissions obviously, and that i attempted setting content-kind of the reaction to "text/xml", "text/html" and "text/plain" - it does not matter. I have attempted using ajax both with XMLHttpRequest and JQuery - same issue with both. i have found these problems, however they don't appear to resolve my problem:
1. http://www.plee.me/blog/2009/08/ajax-with-chrome-empty-responsetext/
2. http://bugs.jquery.com/ticket/7653

here's my code: bg.js (background page)

function saveText(data) {
var requrl = serverUrl + addTextUrl;
var params = json2urlParams(data);
jQuery.ajax({
        type : "POST", 
        url : requrl, 
        data : params, 
        success : function (data, textStatus, XMLHttpRequest) {
            console.log("Data Saved: " + msg);
        }
    });

// var xhr = new XMLHttpRequest();
// xhr.open("POST", requrl, true);
// xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
// xhr.onreadystatechange = function (progress) {
// if (xhr.readyState == 4) {
// console.log("Data Saved: " + this.response);
// }
// };
// xhr.send(params);

addContentServlet.java: (server side)

protected void doPost(HttpServletRequest request,
        HttpServletResponse response) throws ServletException, IOException {
    ErrorCodes error = addContent(request, response);
    response.setContentType("text/plain");
    //response.setContentType("application/x-www-form-urlencoded; charset=UTF-8");      
    //response.setIntHeader("errorCode", error.ordinal());
    response.getWriter().write(error.toString());
    response.setIntHeader("errorcode", error.ordinal());
    if(error == ErrorCodes.SUCCESS){
        response.setStatus(error.toHttpErrorCode());
        response.flushBuffer();
    }
    else{
        response.sendError(error.toHttpErrorCode(), error.toString());
    }           
}

EDIT:

I have observed within the chrome console from the background page that for each ajax that returns towards the extension i recieve a

XMLHttpRequest cannot load http:// localhost:8080/stp_poc/MyServlet. Origin chrome-extension://fmmolofppekcdickmdcjflhkbmpdomba isn't permitted by Access-Control-Allow-Origin.

I attempted losing bg.js and puting all of the code within the primary page rather - with no success. why XMLHttpRequest concurs to transmit the request, although not receive it back?? Perhaps a server-configuration problem? I am a newb, so perhaps i skipped something fundamental, just like a header within the response

EDIT I have finnaly pinned the issue: I should not have incorporated the main harbour number during my permission. Here's the incorrect permission I authored:

"permissions" : [
    "http://localhost:8080/" 
]

And here's the right form:

"permissions" : [
    "http://localhost/" 
]

everything appears to works fine now.

The issue was which i should not have incorporated the port number during my permission.

Here's the incorrect permission I authored:

"permissions" : [
    "http://localhost:8080/"
]

And here's the right form:

"permissions" : [
    "http://localhost/"
]