porno porno rokettube
Results 1 to 2 of 2

Thread: How to receive model via ajax

  1. #1
    Junior Member
    Join Date
    Aug 2014

    How to receive model via ajax


    I have two questions one major one minor. My minor question is why does this simple grails app not work?

    Person Domain
    package ajax
    class Person {
        String firstname
        String lastname
        int age
        static constraints = {
    package ajax
    class HomeController {
        def index() {
        render (view: "index")
        def greet()
            render "hi"
        def getPersons()
            def persons = Person.getAll()
            render(model: [persons:persons])
    <%@ page contentType="text/html;charset=UTF-8" %>
        <g:javascript plugin="jquery" />
    <div id="greeting"></div><br>
    <button onclick='<g:remoteFunction action="greet" update="greeting"/>'>Click on me!</button>
    And finally my major question is, in index.gsp if I wanted to change the button action to getPersons, then how would I get the data via ajax or jquery e.g. g:remoteFunction .And if I did get the data how would I format the data in #greeting so I get the firstname and lastname.

  2. #2
    Junior Member
    Join Date
    Aug 2010
    I know its a little late but if you still want help then let me know .. what problem you having with your app ?

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Forum Design by Tucanoo Solutions Ltd Grails Development Specialists.