Hello
I am very glad to have found this thread! I have tried to implement this type of ajax subscribe functionality on my own many times with various hacky homecooking methods not realizing that the functionality was built in!
However I am having the same FAIL results as other people who had difficulty with this at first.
For testing I am using the same (localhost) domain for the my phplist and the page serving the form so my ajax url is: url: '/lists/index.php?p=asubscribe&id=4',
(subscribe page 4 is a subscribe page that defaults to html email and does not display email address confirmation field).
Just in case it would help I added define('ACCESS_CONTROL_ALLOW_ORIGIN', '*');
to /lists/config/config.php
.
I changed the hidden list input to a list that I have have set up <input type="hidden" name="list[3]" value="signup" />
Other then these changes I am using the code as supplied (generously!) by @duncanc
I am using, PhpList v3.3.1 and PHP v7.0.22
Inspecting the request with dev tools reveals the following:
Query string
p: asubscribe id: 4
Form data
email: me@mydomain.com attribute1: myname htmlemail: 1 list[3]: signup subscribe: subscribe VerificationCodeX:
Response Payload
FAIL
Is there any way to get more detail on what causes the FAIL
response?
Thanks in advance for any suggestions!