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

  • SEARCH
  • Home
  • 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 7698087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:09:38+00:00 2026-05-31T22:09:38+00:00

I have some data from JQGrid that should be exported to excel. So, we

  • 0

I have some data from JQGrid that should be exported to excel. So, we have written a java servlet to write the data to excel and send it back. From the client side we are using an AJAX JSONP request by sending JSON data. I am able to hit the servlet and servlet sending the created excel back to the client. But i am not able to see excel or any kind of output from client side.

When i use the Fiddler and observed the http calls, i found that application received the result. but still it is not showing the result.

Here is my result header, that i have received.

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Disposition: attachment; filename=PistonData.xls
Content-Type: application/vnd.ms-excel
Content-Length: 6144
Date: Tue, 27 Mar 2012 08:49:04 GMT

How to open this result as Excel using JQuery? Can somebody please suggest me a way to fix this issue.

Update #1
Forgot to include request

$.ajax({
        type: "POST",
        dataType: "jsonp",
        contentType:'application/vnd.ms-excel',
        url: "http://devmachine:9010/axis/SPSServlet",
        data: param,
        success: function (dataToSend) {
            alert(dataToSend);
        }
    });

Update #2
As per Oleg’s suggestions i worked out a solution for this problem.

Here is my code:

    <form id="frmExcelExport" style="display:none;">
       <input type=hidden id="partId" name="partId" />
       <input type=hidden id="columnNames" name="columnNames" />
       <input type=hidden id="data" name="data" />
    </form> 

$('#columnNames').val(colModStr);
$('#partId').val(currentPartID);
$('#data').val(dataStr);

var urlForExport = "http://devmachine:9010/axis/SPSServlet";        
$('#frmExcelExport').attr("method", "post");
$('#frmExcelExport').attr("action", urlForExport); 
$('#frmExcelExport').submit();

and it is working very good.
Thanks a bunch to Oleg!!!!

  • 1 1 Answer
  • 0 Views
  • 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-31T22:09:40+00:00Added an answer on May 31, 2026 at 10:09 pm

    I think that you can’t open Excel if you use HTTP POST. The way which will work is to use HTTP GET and encode parameters which you need in the URL:

    window.location = "http://devmachine:9010/axis/StdPartSearchServlet?" +
        $.param({someParamName: "someValue", anotherParam: 123});
    

    In the way the web browser will opens the returned data as PistonData.xls specified in Content-Disposition header with respect of the application registered for application/vnd.ms-excel (see Content-Type header). See the answer for more details.

    If you need to prevent uncontrolled caching of the XLS data returned from the server I would recommend you to set additional HTTP header "Cache-Control: max-age=0" or better "Cache-Control: private, max-age=0" to prevent caching without re-validation on the HTTP proxy. See here, here for additional information.

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

Sidebar

Related Questions

I have some data that comes regularily as a dump from a data souce
I have some existing code that retrieves data from a database using ADO.NET that
We have some C# code that reads data from a text file using a
If have a piece of code that gets some data from a sql database
I have to develop a tool in C# that retrieves some data from an
I have some data from an old table, with a lot of columns that
I have some code that fetches some data from the database, database codepage is
I have a jqgrid in a modal popup that has data dependent on some
I have this code just to send data from already loaded jqGrid: jQuery(#bedata).click(function(){ //Function
I have a jqgrid that contains some data, the first column of which is

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.