Hi everyone, i'm a begginer in ELGG plugin developing, and i'm happy that there is a group for who needs help like me.
GOAL: i want to extract some userpage data with a php page and send it to a "response" placed in a js/JQuery file, i need to use that data for my script.
Problem:
1) the script is executed but i 'm not able to extract and send needed data to my script;
2) if i use JSON encode/decode i have an[object, Object] in console.log
3) if i not use JSON the result in console.log is " {"output":false,"status":-1,"system_messages":{"error":[],"success":[]}} ".
Code:
this is my JQuery/Ajax script:
$(document).ready(function(){
$.ajax ({
url:"mypage.php",
dataType: "json",
success: function(response){
alert(response);
console.log("Response: " +response);
if(response){
//some code
} else{
echo"Some Message";
}
This is my php file , placed in the same directory:
<?php
$owner = elgg_get_page_owner_entity();
echo json_encode($owner['name']);
?>
Please i need help. it's important that i can pass some variable , from PHP to my js file.
i hope in a resolutive answer.
Thanks a lot.
Arthy
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.