Problem with elgg.get

I'm trying to do some test with the Ajax features in Elgg, but when I use the elgg.get function in a script, I don't receive any response.

With Firebug I see an error and this message: "elgg is not defined".

Is there anything else to include or define in the file?

Can anyone show or post a link to an example of the right use of elgg.get, and elgg.action. I find very few information about it and I can't make work examples like in

Any help would be useful. Thank you.

  • There was a typo in the JS on that page, but I corrected it and tried this example and it's working for me.

    Probably what's happening is that you're outputting the JS too early in the script. You need to output it after Elgg's JS engine has been fully loaded. Can you show us your code?

  • Thanks, Brett.

    I have tried your example code and there was no error but the $content value is:

    "<script type = "text/javascript" ...

    ... </script>", I mean, the content of the script; and the elgg_view_page displays nothing.


    I have thought that maybe I don't need to use the elgg.get function, because my aim is just displaying a map showing a search results (users array). The problem is that I don't know how I should pass these results to the page where I have the script creating the map.

    Sorry, my code is quite a mess to be shown at this moment. I'm still a newbie... Could you give me some tip to make this?

    Thanks a lot.

  • I don't understand what you mean. Put the linked code into a file in Elgg's root and then browse to that file and it should output to the JS console the contents of the activity stream.

    It sounds like you should just use GET parameters, and then access them in PHP with get_input().