Newsletter AJAX

I want to use Cleverreach as my newsletter provider. So I got a snippet of a form, which I put in the footer.php. It should be on every site. So… When I put my data in the form and click at the button to submit it, I got an error with XMLHttpRequest:

The user got an email, but the redirect from Cleverreach doesn’t work. Do you have a solution, that I can use Cleverreach as my newsletter provider with this form?

Here’s the AJAX-Call which is in the snippet by Cleverreach
$cr.ajax({ type: "GET", url: $cr(".cr_form").attr("action").replace("wcs", "check_email") + $cr(this).find('input[name=email]').val(), success: function(data) { if (data) { cr_email.addClass('clever_form_error').before("<div class='clever_form_note cr_font'>" + data + "</div>"); return false } }, async: false })

Have you set the redirect links in the Cleverreach settings?

Yes, I set the redirect links in Cleverreach. Maybe it’s a problem by Kirby with external providers?

No, it’s not a Kirby problem. While I don’t know CleverReach, I have implemented another Newsletter provider in the past, which worked just fine.

I overlooked the error message the other day. It tells you what the problem is. The ajax script calls an external URL, so this is a Cross Site Scripting problem you need to fix.

You can do that either in your server config file (if you have access to that) or in your .htaccess:

<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin  
    Header set Access-Control-Allow-Credentials true

Depending on your Ajax call, credentials may be true or false.

Thanks for the help. Can you give me a hint, which value is necessary for “”? Should be there the url from the website or a link by cleverreach?

Should be the domain that is used in the form’s action attribute. You can also use * to allow all domains.