<h2><?php __e('Affiliate link with Custom Landing Page') ?></h2>
<div class="am-aff-banner-preview">
    <div class="custom_redirect">
        <div style="padding-bottom:0.5em;">
            <div><?php __e('Please Enter URL of Your Landing Page')?></div>
            <div style="display: table-cell;" class="am-el-wide"><input type="text" name="url" id="custom_redirect_url" placeholder="http://example.com/page.html" class="am-el-wide" /></div>
            <div style="display: table-cell; padding-left:0.5em;"><input type="button" value="<?php __e('Get Link') ?>" id="custom_redirect-ok" /></div>
        </div>
        <div id="custom_redirect_div" style="display:none; padding-bottom:0.5em;">
            <label><?php __e('Your Custom Affiliate Link')?></label>
            <input type="text" name="link" id="custom_redirect_link" class='am-el-wide'/>
        </div>
    </div>
</div>
<script type="text/javascript">
jQuery(function(){
    jQuery('#custom_redirect-ok').click(function(){
        var url = amUrl("/aff/aff/clink", true);
        jQuery.ajax({
            type: 'POST'
            ,url: url[0]
            ,data : jQuery.merge(url[1], [
                { name:"url", value:jQuery("#custom_redirect_url").val() }
            ])
            ,success: function(data, textStatus, request)
            {
                jQuery("#custom_redirect_div").show();
                jQuery("#custom_redirect_link").val(data['link']);
            }
        });
    })
});
</script>