locked
append object tag into body element RRS feed

  • Question

  • User-1634604574 posted

    i have this code

    
    <script>
    
     var req = {
                    file_html:$("#print_format").val() + ".html"
                }
                $.ajax({
                    type: 'post',
                    data: req,
                    url: "/Print_Format/GetCSHTML",
                    cache: false,
                      'file_html': $("#print_format").val() + ".html",
                    success: function (data) {
                       // alert("sucsess")
    
                    },
                    error: function (ob, errStr) {
                        alert("An error occured.Please try after sometime.");
                    }
                }).done(function () {
    
    
                    var style = document.createElement('object');
                    var body = document.getElementsByTagName("body")[0];
                    style.setAttribute('type', 'text/html');
                    style.setAttribute('data', '/Print_Format/GetCSHTML');
                    style.setAttribute('width', '920')
                    style.setAttribute('height','667')
                    body.appendChild(style)
                  //  document.body.appendChild(style)
                    //$('#div_content_print').append("<object style='background-color:transparent' width='920' height='667' data='/Print_Format/GetCSHTML' type='text/html' />");
    
                  //  document.getElementById("div_content_print").innerHTML = "<object style='background-color:transparent' width='920' height='667' data='/Print_Format/GetCSHTML' type='text/html' />"
                })
    
    </script>

    controller Print_Format

      public ActionResult GetCSHTML(string file_html,string series)
            {
               
                string f_html = @"C:\temp\"+ file_html + "";
                return File(f_html, "text/html");
    
            }

    i get this error

    <title>Could not find a part of the path 'C:\temp\'.</title>

    Saturday, October 5, 2019 6:51 AM

All replies

  • User61956409 posted

    Hi zhyanadil.it@gmail.com,

    i get this error

    <title>Could not find a part of the path 'C:\temp\'.</title>

    Please debug your code and check if the parameter of "file_html" has been passed to your controller action, and please check if the path of the file is existing.

    With Regards,

    Fei Han

    Monday, October 7, 2019 2:32 AM
  • User-1038772411 posted

    Please check if this path exists on the server

    "C:\temp\"
    Monday, October 7, 2019 6:52 AM