Hi guys.
I am completely lost. I read some data from a file uploaded to the server. Now i need to pass that data to a javascrypt file to display it on a google api.
How do you do this in elgg
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Eugee@EugeneDeKlerk
Eugee - 0 likes
- ihayredinov@ihayredinov
ihayredinov - 0 likes
- Eugee@EugeneDeKlerk
Eugee - 0 likes
- ihayredinov@ihayredinov
ihayredinov - 0 likes
- Eugee@EugeneDeKlerk
Eugee - 0 likes
- Eugee@EugeneDeKlerk
Eugee - 0 likes
- Eugee@EugeneDeKlerk
Eugee - 0 likes
- ihayredinov@ihayredinov
ihayredinov - 0 likes
You must log in to post replies.ok i have found what im looking for the problem is im struggling to implement this.
Im assuming you use elgg.post to make a server request and recieve the data back. the only problem is that there is zero documentation on this function.
can anyone help
Take a look at inline documentation for elgg.post or elgg.getJSON
Dont want to sound like an idiot but where do i find those?
I have lookes in the ajax.js file, but does not provide much information.
neither does http://docs.elgg.org/wiki/Javascript/Ajax
Second parameter is an object that takes all params that qualify a query $.ajax request
elgg.post(url, { data : { guid : 555 } } )
in other words this should return what ever is echo'd in returntext.php
elgg.post("returntext.php", {
success: function(resulttext) {
alert(resulttext);
}
});
provided that returntext is in my elgg root folder if it was in say mod/hello_world
the url would be mod/helloworld/returntext.php
Thank you Ismayil I got that working. The problem now is that I am working with the files plugin. I have the view open where the file is displayed normally. To this view i have added a div for a map api and i run the javascript. This all works fine and the post works fine as well. but how do i get access to the file GUID from the php called by the post.
Hope my question is clear
When rendering your div you can add an attribute with the file guids, i.e. <div id='my-div' data-guid="$guid">. In your JS, get the guid by $('#my-div').data('guid') and then do what you need to do.