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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:20:01+00:00 2026-06-13T23:20:01+00:00

I searched the net and also here at stackoverflow, but I couldn’t find any

  • 0

I searched the net and also here at stackoverflow, but I couldn’t find any hint on this…

I’ve got a Grails 2.1.1 project and I want to call a Controller function from jQuery with an Ajax request. So far, I come up with this:

$.ajax({
    type: 'POST',
    url: "${createLink(controller:'userSearch',action:'ajaxFindUser')}",
    dataType: 'json',
    data: {
        lastname: $('#searchLastName').val(),
        firstname: $('#searchFirstName').val(),
        zipcode: $('#searchZipCode').val(),
        city: $('#searchCity').val()
    },
    success: function(data) {
        $('#searchSubContainerBody').html(data);

        $('#searchTable tr').draggable({
           cursor: 'move',
           helper: 'clone',
           scope: 'drag-guests',
            start: function(event, ui) {
              searchCloneTableRow.tr = this;
                searchCloneTableRow.helper = ui.helper;
                searchCloneTableRow.cells = new Array();
                $.each(this.cells, function(index, column) {
                    searchCloneTableRow.cells.push(column.innerText);
                });
            },
            connectWith: '#searchDetailContainerDropArea'
        });

        $('searchTable').dataTable({
            'bJQueryUI':true
        });

    },
    error: function(request, status, error) {
        $(errorDialog).html(error);
        $(errorDialog).dialog('open');
        return false;
    },
    complete: function() {
        //do something
    }
});

and when I click on the button to fire the Ajax request, the DevTools show the following error:

POST > http://localhost:8080/GrailsTest001/authentication/$%7Bg.createLink(controller:'userSearch',action:'ajaxFindUser')%7D 404 (Not Found) 

so, as you can see, the URL get’s HTML encoded… how can I prevent Grails from encoding it?

in Config.groovy the codec is set to none:

// The default codec used to encode data with ${}
grails.views.default.codec = "none" // none, html, base64

what am I doing wrong here? could you give me any hint (or better: a solution) for this? any help is greatly appreciated!

  • 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-13T23:20:02+00:00Added an answer on June 13, 2026 at 11:20 pm

    The GSP snippet

     ${createLink(controller:'userSearch',action:'ajaxFindUser')}
    

    is not getting interpreted – is this in a javascript file or in actual GSP? It looks like it’s defined in a javascript file. If so, it won’t work, you’ll need to create a javascript var on the GSP page, and then reference that javascript var from your ajax call. For example:

    In your GSP code:

    <g:javascript>
      var ajaxAction = "${createLink(controller:'userSearch',action:'ajaxFindUser')}"
    </g:javascript>
    

    In your javascript file containing the ajax code:

    $.ajax({
        type: 'POST',
        url: ajaxAction,
        dataType: 'json',
        data: {
      ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I searched for this problem but couldn't find solution that works for me. I'm
I'm new to asp.net mvc, but I've thoroughly searched on this topic everywhere. I've
As I am new to this field. I searched a lot over net but
I searched the net for hours, but I'm stuck. I used a tutorial for
I have searched the net and searched the net only to not quite find
I have tried dllimport and extern command without any success. Searched the net for
I've searched the web, and I can only find marketing material on .net 4.
I am using c# .net. Thanks in advance for any help. I have searched
What are the requirements for the upcoming .NET 4 release? Searched around for this
I know this question has been asked many times, and I've searched stackoverflow and

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.