How to use correctly the ' inside this javascript.
i try this different solutions but it does not work
$introduction = 'Hello, it\'s chrismas'.
$introduction = str_replace(''', '', $introduction);
$introduction = json_encode($introduction);
$introduction = stripslashes(htmlspecialchars_decode($introduction, ENT_QUOTE);
There the complete code.
if (MODULE_WEB_PUSH_SPECIAL == 'True') {
$special_products = $this->getSpecialsProducts();
if (!empty($special_products) && $_SESSION['SpecialsProducts'] === false) {
$message_products_special = $special_products;
$_SESSION['SpecialsProducts'] = true;
$special_link = CLICSHOPPING::link(null, 'Products&Specials');
$output .= '
<script>
Push.create(\'' . $introduction . '\', {
body: \'' . $message_products_special . '\',
icon: \'sources/images/logos/others/favicon.png\',
timeout: 8000, // Timeout before notification closes automatically.
vibrate: [100, 100, 100], // An array of vibration pulses for mobile devices.
onClick: function() {
window.location = "' . $special_link . '";
}
});
</script>
';
}
}