0
votes

I am calling an api and getting some values in json format now I want to restrict some user on client side based on the response I get from the api. for example if user is a guest then it haven't show the subscribe button otherwise it have. In developer portal we use DotLiquid view engine. Now i have one question how can i use this in dotliquid. here is my code where i use Jquery to get data and javascript to restrict the user on client side


Code

<script   src="https://code.jquery.com/jquery-2.2.4.js"   integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI="   crossorigin="anonymous"></script>
<script>
var root = 'https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false';

$(document).ready(function () {
        var showData1;
  $('#get-data').click(function () {
    var showData;

    jQuery.ajax({
    url: "https://httpbin.org/get",
    dataType:'json',
    success:function(response)
    {
        $('#a').html(response.origin );
        $('#b').html(response.url );
          if(response.url=="https://httpbin.org/get"){
      $("#a").fadeOut(1000);
  }
    }
    });

    showData.text('Loading the JSON file.');
  });
  
  

});
</script>


<!DOCTYPE html>


    <a href="#" id="get-data">Get JSON data</a>
    <div id="show-data"></div>
    <p id="a"></p>
    <p id="b"></p>
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    
1

1 Answers

0
votes

I can't quite tell from your source code, but in the DotLiquid templates we use on the developer portal the template variables are fixed currently. Please add your feature request to have user variables in each template to our feedback portal http://aka.ms/apimwish