Using PHP script to call json data and from database Grails do slow data fetch

I am using php as my front end and grails as my back end. But it ruins my data fetch.

how can I increase the performance?

  • Grails resource tag generating wrong link
  • Grails using grails var in GSP Site inside javascript
  • How to setup Grails and AngularJS partial templates
  • How do I reference a static HTML rsource using the Grails Asset plugin?
  • Render partial view on the server or send json data and render template on the client
  • jQuery trying to handle ajax failure and sucess not working
  • the php script is like this /userdata.php file

    $uid=$_GET['uid'];
    function getData($uid)
    
        {
            $dataUrl='http://localhost:8080/profile/user/teacher?id='.$uid;
            $json=file_get_contents($dataUrl);
            print_r($json);
    
        }
    getData($uid);
    

    javascript which calls this php script is

    $.getJSON('userdata.php?uid'+1,function(data){
        console.log(data);
    });
    

  • how to pass a javascript var value to a Grails controller?
  • Sending JSON to javascript on GSP
  • Exposing message.properties to javascript?
  • Pass Javascript Variable into createlink method call Grails
  • Language injection in IntelliJ for grails asset-pipeline plugin
  • grails remote form, multiple submits, with javascript
  • One Solution collect form web for “Using PHP script to call json data and from database Grails do slow data fetch”

    This is so slow part:

    $json=file_get_contents($dataUrl);
    

    Try сache this.