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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:23:18+00:00 2026-06-14T00:23:18+00:00

I’m struggling with the <g:formRemote/> onSuccess method and how I could call my custom

  • 0

I’m struggling with the <g:formRemote/> onSuccess method and how I could call my custom JavaScript function properly.

I have the following formRemote element:

<g:formRemote name="userSearchRemoteForm"
                      url="[controller: 'userSearch', action: 'ajaxFindUser']"
                      onLoading="jQuery('#userSearchSubContainerHeadLoaderImage').show()"
                      onSuccess="createUserTable(data)"
                      onComplete="jQuery('#userSearchSubContainerHeadLoaderImage').hide()">
....</g:formRemote>

in debug mode I see, that the Controller function ajaxFindUser is called and returns a valid JSON object like this (from the console with prettyPrint == true):

{"success": {
"376440": {
  "phone": "",
  "email": "janeDoe@test.com",
  "lastname": "Doe",
  "firstname": "Jane"
},
"4146": {
  "phone": "555-123456789",
  "email": "johnDoe@test.com",
  "lastname": "Doe",
  "firstname": "John"
}
}}

my JavaScript function createUserTable looks like this:

function createGuestTable(data) {
console.log(data);
}

all I see in my WebDev Tool is the following response:

POST http://localhost:8080/GrailsTest001/userSearch/ajaxFindUser 404 (Not Found)

and my function is never called. I also tried to call the JavaScript function in onSuccess like this:

onSuccess="createUserTable()"

but I still get the same result…

what am I doing wrong here?


Edit: to clear things out – here’s my Controller function:

def ajaxFindUser(UserSearchCommand userSearchCommand) {
    println("... in ajaxFindUser()")
    def result = [:]

    if (userSearchCommand.hasErrors()) {
        result['fail'] = "Error in search values!"
    } else {
        println("... creating values for search...")
        def user = (User) session.getValue(theUser)
        def inputMap = createInputMap(userSearchCommand)

        def foundUsers = userSearchService.findUser(user.connectionID, user.language, inputMap)

        if (foundUsers == null) {
            println("... search returned NULL!")
            result = [:]
            result['fail'] = userSearchService.getError()
        } else {
            println("... search returned VALUES!!")
            result['success'] = foundUsers
        }
    }

    def jResult = result as JSON

    println(".... returning JSON: ${jResult.toString(true)}")
    return jResult
}
  • 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-14T00:23:20+00:00Added an answer on June 14, 2026 at 12:23 am

    oh my!
    I was facing the problem but didn’t recognize it would be a problem at all…

    I just changed the last line of my ajaxFindUser function from

    return jResult
    

    to

    render jResult
    

    with the following onSuccess parameter

    onSuccess="createUserTable(data)"
    

    and all is working well!!

    sorry for that…

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a small JavaScript validation script that validates inputs based on Regex. I
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
This could be a duplicate question, but I have no idea what search terms
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am reading a book about Javascript and jQuery and using one of the
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,

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.