1. Home
  2. SDK / REST-Api
  3. E-Mailangebote JSON

E-Mailangebote JSON

URL
https://xxxxx.accounts.beraterportal.net/REST/mailoffer/advicer/xxx– Berater ID — xxx/

<div class="mailoffer">
    <div class="mailoffer__head" style="margin-bottom: 10px;">
        <h3>E-Mail Angebote</h3>
    </div><!-- /.mailoffer__head -->


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

    </div>


    <script type="text/template" id="template_mailoffer-nooffer">

        <div class="mailoffer_center" ><h3>keine E-Mailbertungsangebote</h3></div>
        <div><button class="wp-block-button btn smallTxt" onclick="SDKAPP.popup_send_email('<?php echo $advicer->user_id; ?>');"">Jetzt angebot anfordern</button></div>
    </script>



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

        <div class="mailoffer-item">

            <span>{title}</span>
            <div class="offer__inner">{preis} €</div>
            <button class="wp-block-button btn smallTxt" onclick="SDKAPP.popup_show_email('{id}'); return false">Zum Angebot</button>

        </div><!-- /.mailoffer__item -->
    </script>




</div><!-- /.mailoffer -->


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

        $.getJSON( "https://xxxxx.accounts.beraterportal.net/REST/mailoffer/advicer/xxx-- Berater ID -- xxx/", function( data ) {
             var items = [];
            $.each( data.data.mailData, function( key, val ) {

                var html = $('#template_mailoffer-item-list').html();
                html = html.replace(/{preis}/g, val.preis)
                    .replace(/{beschreibung}/g, val.beschreibung)
                    .replace(/{id}/g, val.id)
                    .replace(/{title}/g, val.title)

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

            });

            if(typeof data.data.mailData !="object"){
                var html = $('#template_mailoffer-nooffer').html();
                $('#mailoffer-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