这里有个类似的问题:http://stackoverflow.com/questions/3595515/xmlhttprequest-error-origin-null-is-not-allowed-by-access-control-allow-origin

解决方案 »

  1.   

    跨域了吧。。跨域请求需要服务器页面设置Access-Control-Allow-Origin响应头允许调用才行
      

  2.   

    多谢楼上的提示,是跨域的,在远程的后台服务器添加:response.addHeader("Access-Control-Allow-Origin","*") ;
    用chrome刘篮球就OK了,但是用IE不行
      

  3.   

    看来得另找别路了:
    jquery官网说的http://bugs.jquery.com/ticket/7282
      

  4.   

    解决的方式是在请求端的java写request请求private List<PmcxView> getQxpm() {
    List<PmcxView> qxpmList = new ArrayList<PmcxView>();

    HttpClient client = new HttpClient();
    HttpMethod method = new GetMethod("http://61.142.114.227:8808/wljf/cjgl/pmcx.do?action=getQxpm&n=20");

    try {
    client.executeMethod(method);
    if (method.getStatusCode() == HttpStatus.SC_OK) {
    String jsonStr = method.getResponseBodyAsString();
    JSONObject json = JSONObject.fromString(jsonStr);
    JSONArray arr = (JSONArray) json.get("rows");
    for(int i = 0; i < arr.length(); i++) {
    PmcxView p = (PmcxView) JSONObject.toBean((JSONObject) arr.get(i), PmcxView.class);
    qxpmList.add(p);
    } }
    } catch (IOException e) {
    e.printStackTrace();
    } finally {
    method.releaseConnection();
    } return qxpmList;
    }
    然后再将qxpmList传到页面,OK了