可以Dojo请求/ iframe读取响应

时间:2014-07-09 00:39:30

标签: iframe dojo xmlhttprequest

接收JSONObject但无法读取JSONOject响应。它在正文中,在将帖子传递给servlet后无法访问。为什么选择iframe,因为在使用asynch时,我不知道以任何其他方式上传文件。请帮忙。我真的很困惑。

 require(["dojo/request/iframe", "dojo/dom", "dojo/dom-form", "dojo/dom-construct", 
   "dojo/json", "dojo/on", "dojo/domReady!"],
 function(iframe, dom, domForm, domConst, JSON, on){

 on(dom.byId("startButton"), "click", function(){

  iframe("addUser",{
  form: "myForm",Ca
  handleAs:"json",

  }).then(function(response){   
  alert(response);
  alert("data received!");    

  }, function(err){    
  alert("data denied!!!");    
   alert(err);

*********************** Servlet JSON响应************** ******************

      JSONObject cert = new JSONObject();
        cert.put("version", x509certificate.getVersion());
        cert.put("valid from", x509certificate.getNotBefore());
        cert.put("valid to", x509certificate.getNotAfter());
        cert.put("issuer", x509certificate.getIssuerDN().getName());
        cert.put("Thumbprint", getThumbPrint(x509certificate));

        System.out.println(cert);
        System.out.println(cert.toString());
        out.print(cert.toString());

0 个答案:

没有答案