Maybe I'm missing something, but document.write(result) will only work if the variable result has a value, and I can't see it being set anywhere ?

Liam

MrFishKill wrote:
Hi,

Sometimes, via AJAX,  I'm getting binary content from a server
(application/octet-stream), other times html-text. When server response with
binary content  (PDF, EXCEL, etc) I'like to send to user.
It's possible????

This is my code:

function CNMSubmitAjax(arguments,id_capa, extra_props)
{
   var ret;
   var _msg="";
   $.ajax
   (
       {
              type: "POST",
              url: CNMCONTROLLER,
              cache: false,
              async: ASYNC,
              data: arguments,
              beforeSend: CNMWaitWindowStart(),
              error:  function (o,msg,eoerror)
                      {
                          CNMShowAjaxError(o,msg,eoerror);
                      },
              success: function (msg)
                       {
                           _msg=msg;
                           CNMWaitWindowStop();
                       },
              complete:function (xml_http_request)
              {
                  //Is it binary Type?????
                   var content_type =
xml_http_request.getResponseHeader('Content-Type');

                   if (content_type == "application/octet-stream" )
                   {
document.write(result); <---------------------- Don't work !!!!! It's possible?
                   }
                   else
                   {
                       .........
                    }
              }
        }
    );
}


Thanks in advance....

Reply via email to