Getting undefined JSON error because of Stripe script?!
Hi everyone!
I'm a bit lost... hope for your help.
Here is my script.. nothing epic but works fine:
<!-- Open Map Button - Locator -->
<button id="openicon">Open Map 2</button>
<br >
<p id="example"></p>
<!-- Open Map Script - Locator -->
<script>
jQuery(document).ready(function(){
jQuery("#openicon").click(function()
{
openLocator({width:'1024',height:'768',address:'torino',modView:'101'});
});
});
</script>
<!-- Get JSON data from locator -->
<script>
if(window.addEventListener){
window.addEventListener("message", myfunction, false)
} else {
window.attachEvent("onmessage",myfunction)
}
function myfunction(event) {
if (event.data !== 'null') {
dataJSONLocator = JSON.parse(event.data);
console.log(dataJSONLocator);
var obj = JSON.parse(event.data);
jQuery("#example").text( obj.name + "\r\n" + obj.address + "\r\n" + obj.city + " (" + obj.prov + ")" + ", " + obj.cap ).attr('style','display: block !important');
}
}
</script>
The problem started when i added Stripe js to my website. JSON array is now getting undefined error.
Is there any tip how to fix it?
Thanks a lot!