1. Home
  2. SDK / REST-Api
  3. Bewertungen JSON

Bewertungen JSON

URL:
https://xxxxx.accounts.beraterportal.net/REST/poll/advicer/xxx– bearater ID–xxxxx/25/1

Parameter

Beispiel Javascript für Jquery

<div>
    <div class="guestbook-list" id="guestbook-item-list">

    </div>

    <script type="text/template" id="template_guestbook-item-list">

        <div class="guestbook-item">
            <div class="guestbook__head">
                <h6>{name} schrieb am {datum}</h6>

                <ul class="list-rate">
                    {stars}
                </ul>
            </div><!-- /.guestbook__head -->

            <div class="guestbook__body">
                <p>{text}</p>
            </div><!-- /.guestbook__body -->
        </div><!-- /.guestbook__item -->
    </script>
</div>


<script>
    $( document ).ready(function() {


        $.getJSON( "https://xxxxx.accounts.beraterportal.net/REST/poll/advicer/xxx-- bearater ID--xxxxx/25/1", function( data ) {
            var items = [];
            $.each( data.data, function( key, val ) {
                //   console.log(key,val);

                stars="";
                for(i=0; i<val.stars; i++){
                    stars+=" <li><i class=\"ico-star\"></i></li>";
                }

                if(val.user_text.length <= 0) val.user_text="Danke";

                var html = $('#template_guestbook-item-list').html();
                html = html.replace(/{name}/g, val.from_user)
                    .replace(/{datum}/g, val.insertdate)
                    .replace(/{text}/g, val.user_text)
                    .replace(/{stars}/g, stars)


                $('#guestbook-item-list').append(html);

            });


        });



    });
</script>


Updated on 12. Dezember 2019

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support