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 9169407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:52:30+00:00 2026-06-17T15:52:30+00:00

I have this ajax code: $.ajax({ type: POST, url: ${createLink(controller:’MyController’, action:’downloadFile’) } target=\_blank\ ,

  • 0

I have this ajax code:

$.ajax({
       type: "POST",
       url: "${createLink(controller:'MyController', action:'downloadFile') } target=\"_blank\" ",
       data: {'names':JSON.stringify(names)},
       dataType: 'json'
});

Which calls this controller method, which works

def downloadFile =
{
    List<JSON> Mynames = JSON.parse(params.names)
    Mynames.each{println "MY ID is: $it"}

    [Mynames:Mynames]
}

It prints out the MY ID Is Lines, but it doesn’t render the downloadFile View which is this:

<%@ page contentType="text/html;charset=UTF-8" %>
<html>
   <head>
    <title></title>
   </head>
   <body>
    test
   </body>
</html>

However, it is not rendering it. How can I fix this? Thanks.

  • 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-06-17T15:52:30+00:00Added an answer on June 17, 2026 at 3:52 pm

    Please take some time to do some reading on Ajax and what it is used for and how it works. You have a fundamental misunderstanding.

    $.ajax({
           type: "POST",
           url: "${createLink(controller:'MyController', action:'downloadFile') } target=\"_blank\" ",
           data: {'names':JSON.stringify(names)},
           dataType: 'json'
    });
    

    The above code submits a request to your controller. Here’s the key point; it does not refresh your page or put any data on your page. It only returns data to you in JavaScript.

    You’re controller isn’t even returning the correct response based on your $.ajax() functions dataType parameter. The dataType property tells the $.ajax() function what kind of data to expect as the response.

    jQuery $.ajax() docco

    If you need to render HTML as a response to your ajax request, the easiest way is to use the $.load() function.

    There are a few other ways but for the sake of keeping things simple for you I won’t go into them here. Seriously though, not trying to be rude, but I’ve read some of your other questions. You really need to get a better understanding of the tools you’re using.

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

Sidebar

Related Questions

I have this code that works well: {livre:empty_name} $.ajax({ url: sent.php, type: post, dataType:
I have this code: $.ajax({ type: POST, url: URL, data: data, dataType: 'jsonp', crossDomain:
i have this little code to post to my server $.ajax({ type: 'POST', url:
I have this JavaScript code: $(document).ready(function(){ $('#sel').change(function(){ $.ajax({ type: POST, url: modules.php?name=TransProject_Management&file=index, data: &op=index_stat&stat=+$(this).val(),
I'm have a problem loading a site. Using this code: $.ajax({ type: POST, //url:
I have this ajax code: return $.ajax({ type: POST, url: somefile.php, cache:false, data: {
i have this code for sending data var test={imagename:apple.jpg,x:13,y:33}; $.ajax({ type: POST, url: some.php,
I have this code in jquery: $.ajax({ type: POST, url: tosql.php, data: {textnode: textnode},
I have this piece of code: function MyFunction() { $.ajax({ type: POST, url: ajax.php,
i am using ajax with jquery .i have written this code: $.ajax({url:myurl.php, data:datastr, type:POST,

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.