Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 963829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:43:50+00:00 2026-05-16T01:43:50+00:00

$.getJSON( dUrl, data:'{ a: 2, b: 3 }’, function(data){alert(data);} }); Will making a $.getJSON()

  • 0
 $.getJSON( 
     dUrl,
     data:'{ a: 2, b: 3 }',
     function(data){alert(data);}
      });

Will making a $.getJSON() request be able to pop up the pdf/docx in a new window? if yes, could you please share more info on this..

I’m getting the pdf/docx file from Response stream into Fiddler.
But need to find a way to push it to Save As Dialog box.

Any help is appreciated…

Here is the Custom ActionResult

public class DownloadResult : ActionResult
    {

        public DownloadResult()
        {
        }
        public DownloadResult(string virtualPath)
        {
            this.VirtualPath = virtualPath;
        }

        public string VirtualPath
        {
            get;
            set;
        }

        public string FileDownloadName
        {
            get;
            set;
        }


        public override void ExecuteResult(ControllerContext context)
        {


            //context.HttpContext.Response.TransmitFile(filePath);
            //context.HttpContext.Response.WriteFile(filePath);
            //context.HttpContext.Response.Flush();
            // Response.BinaryWrite(content)
            //Response.ContentType = "application/msword";
            //Response.ContentType = "application/pdf";
            string filePath = this.VirtualPath;
            if (!string.IsNullOrEmpty(filePath))
            {
                byte[] content = System.IO.File.ReadAllBytes(filePath);
                string contentType = "";
                if (filePath.ToLower().Contains(".pdf"))
                    contentType = "application/pdf";
                else
                    contentType = "application/msword";

                context.HttpContext.Response.Buffer = true;
                context.HttpContext.Response.Clear();
                context.HttpContext.Response.ContentType = contentType;
                if (!string.IsNullOrEmpty(FileDownloadName))
                {
                    context.HttpContext.Response.AddHeader("content-disposition", "attachment; filename=" + this.FileDownloadName);
                }
                context.HttpContext.Response.OutputStream.Write(content, 0, content.Length);
            }
        }
}

Controller’s Action :

 public ActionResult DownloadDocument(string uri)
        {
            if (!string.IsNullOrEmpty(uri))
            {

                string targetPath = ConfigurationHelper.GetFolderPath("TempStoreFolder");

                if (string.IsNullOrEmpty(targetPath))
                {
                    targetPath.LogDebug("[TempStoreFolder] setting is not defined in the configuration");
                    return null; 
                }
                uri = Path.Combine(targetPath, uri);

                var downloadResult = new DownloadResult
                {
                    VirtualPath = uri,
                    FileDownloadName = uri
                };
                return downloadResult;
            }
            return null;
        }
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T01:43:51+00:00Added an answer on May 16, 2026 at 1:43 am
    $("#frmdownloadDocuments").attr('action',dUrl);
    $("#frmdownloadDocuments").submit();
    

    Simple Form Submit from this Link gets me the Response as Download dialog.

    I shouldn’t have used $.getJSON() request to download PDF.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

javascript code: $.getJSON(comprueba_login.php, {usuario:$(#usuario).val(), pwd:$(#contrasena).val()}, function(data){ alert(resultado: + data.resultado); }); php code: <?php include
I have a simple getJson request: $.getJSON('JsonTest', function(o) { alert(o.Test); }); It works, but
$.getJSON('http://twitter.com/followers/ids.json?screen_name=/…'+ query1 + '&callback=?', function(data) { alert('JSON data string 1 is: '+data); $.getJSON('http://twitter.com/followers/ids.json?screen_name=/…'+ query2
$.getJSON(http://localhost:8080/v1/message, function(data) { console.log(data); alert(message+data);//this alert stmt is displayed it means that the service
i know this: $.getJSON( test.js, function(json){ alert(JSON Data: + json.users[3].name); } ); but i
$.getJSON('http://23.21.128.153:3000/api/v1/holidays', function(data){ alert(this: + data.holiday[0].name); }); I'm trying to access the name attribute of
$.getJSON('http://twitter.com/followers/ids.json?screen_name=' + query1 + '&callback=?', function (data) { console.log('JSON data string 1 is: '
$.getJSON('ajax_popup.php', function(data) { var popupDiv = decodeURIComponent(data.data); $('body').append( popupDiv ); }); This piece of
$.getJSON(service + /GetJobTags, { tag: a }, function(json) { $.each(json, function(i,val) { alert(val.Title); });
$.getJSON(./data/revenue-item-data.php,{val:'val'},function(data){ $('#totalUnits').val(data[0].SUM(item_qty)); $('#totalAmounts').val(data[0].SUM(DISTINCT net_total)); }); Here is array I get for above code: [{SUM(item_qty):68,SUM(DISTINCT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.