Fix JS button

Job ID: 31780902

Budget: £10 – £15 GBP

I have a dummy site being built to test a prototype. Part of the functionality is, when the save button is clicked it should call my JS api. when it calls my api a pop up page should open for the user to login. when user has logged in, it saves the item to my server. But problem is the button is not working.

here is edited code to call the js api

<script type="text/javascript" src="https://somelink.com/libs/api.js"></script>

here is the save button code

<a href="javascript:void(0)" class="btn btn-primary" onclick='send_to_clickly_server(<?php echo $clickly_js_array; ?>, this);'>Save to Cart</a>

here is the script code

<script>

Clickly.key('apikey');

function send_to_clickly_server( product, button = '' ){

Clickly.item( product );

Clickly.save( button );
}

</script>
Related categories: PHP JavaScript AJAX jQuery / Prototype