Fetch data from MyphpAdmin DB and display in UI

Hello everyone,

in my home page, i have an icon for plumber and i want that, when i click on the icon, it should display the list of all plumbers that i stored in my DB.

var Observable = require("FuseJS/Observable"); var data = Observable();

function goToPlumber() {
try {
var obj = query(“SELECT * FROM wp_usermeta WHERE meta_valeu = ‘plumber’”);
var toJson = JSON.parse(obj);
console.log(data.replaceAll(toJson));
router.push(“PlumberPage”);

 }
 catch (e) {
     console.log("\n" + e);
 }

}
module.exports = {
goToPlumber: goToPlumber,
}

    <DockPanel>
      <StatusBarbackground Dokpanel.Dock=“Top“ />
        <ScrollView ClipToBounds=”true”>
        <StackPanel>
               <Each Items=”{toJson}”>
            </Each>
     </StackPanel>
  </ScrollView>

But it’s not working and i don’t really know how i con continue. Any help will be very appraciated

What json output are you getting? Does the query function work?

If you are using “data” variable as an Observable, you should export that (module.exports) and inject it with the objects from the JSON output. Now you are using “toJson” as Items in Each, but it has not been declared as an Observable. Another thing is “query” function; how is that defined?

Thanks @aeq and @Matti_Tihverainen for the help. Since i’m using Wordpress, i solved it this way:
With some Wordpress functions, i wrote the implementation and i put the url of that Wordpress function in my HTTP Requests fetch in Fuse. it’s the same fetch HTTP Request fetch i used for my registration but i changed and added some parameters

If you can get a reasonable JSON output from the function (test with console.log), I suggest you focus on the use of Observables bit.