Problem in loading json get in ionic 2

hello my ionic 2 app cannot load specific url to get json data form it mysql
this is my php code to get data form mysql database

this is my code

<?php //Importing Database Script require_once('dbConnect.php'); //Creating sql query $sql = "SELECT * FROM about"; //getting result $r = mysqli_query($con,$sql); //creating a blank array $result = array(); //looping through all the records fetched while($row = mysqli_fetch_array($r)){ //Pushing name and id in the blank array created array_push($result,array( "subject"=>$row['subject'], "id"=>$row['id'], "image"=>$row['image'], "description"=>$row['description'], )); } //Displaying the array in json format echo json_encode($result); mysqli_close($con); this is my code to load data from url Loadabout() { return this.http.get('URL') .map(res => res.json()) } thanks alot for help
1 Like
Use like this: 

this.http.get("URL HERE")
            .subscribe(data => {
              var JSON= data.json();
                
            }, error => {
                console.log(error)
            });

my problem in php code can you give me php code to get data and it worked in ionic 2

1 Like

Sorry, I am not expert in php.

You say your Ionic app can’t load some URL. Then you post some PHP code. How is this PHP code relevant? Is the PHP code actually failing and the Ionic app only cannot load it because your PHP is failing?

Please describe your problem correctly.

i solve the problem i was forget to put head utf8 in php