Getting error to use the hubspot blog api in hubspot custom html module via javascript


#1
<script type="text/javascript">
$(document).ready(function() { 
 
$.ajax({
        url: 'https://api.hubapi.com/content/api/v2/blog-posts?hapikey=demo&limit=100&state=PUBLISHED',
    type: 'GET',
    dataType: 'json',
success: function() { console.log("Success"); },
error: function()   { console.log('Failed!'); }

});
});


</script>

#2

@Raman_verma The request has to be made server side.


#3

@pmanca yes obvious request is on server side I have added the code in HUBSPOT Custom html module …

Please read the title of the topic where I have mentioned that I am using hubspot website page where I have placed this code in custom html module


#4

@Raman_verma The code you posted is JQuery which is client-side. Also for the record a hubspot website page is client side as well. Also I received the error you sent Takeaki Fujita which tells me as well its a CORS request issue and that you are making it client side.