Ajax only works for some users
Ajax doesn’t work when I try to ask/answer questions in a Subscriber role.
For example, when I click ‘Post answer’ as an Administrator, I get the ‘Answer submitted successfully’ confirmation. When I do the same as a Subscriber, nothing happens – but the answer is still posted, so you’ll get lots of double/triple posts.
I don’t know how to troubleshoot this. Any ideas welcome.
Did you tried with AnsPress participants role? show us ajax response in console.
Its because there are some unexpected string returned with ajax response. Check console log of your browser and see what actually returned by ajax. Genrally it is php error reporting message.
Thanks again.
Console says [object error] … invalid cha … “SyntaxError” … anpress-site.min.js (1,2787) … function __defineGetter__() … function __defineSetter__() … description “Invalid Character” … number -2146827274 …
Lots of info in that browser console, but I can’t figure out how to copy it and don’t know what is important. I have a screenshot I could send.
You are very welcome to register a test account on dfmforum.com and see for yourself.
The script is otherwise excellent, perfect for my project, so I hope I can get it working.
Edit: I get the exact same anpress-site.min.js SyntaxError on a third clean install with the GitHub development version of AnsPress.
Thank you for your response.
I tried making the Test Member an Administrator and ajax still didn’t work, so I am not so sure if it has anything to do with those roles anymore.
It feels kinda random. Everything works fine with the original Admin account on the blog. It worked on a second pre-existing admin, until it didn’t. I’ve never seen it working for new users.
I don’t know how to troubleshoot ajax. How can I ‘show ajax response in console’?
Basic situation: data does get submitted, but no ‘success’ message is shown. And there is no ‘exit’, because clicking ‘answer’ will just produce endless double posts.
What could cause that in ajax scripts, in general?
> Did you tried with AnsPress participants role?
Would I have to set that manually for each user? I am trying to get this to work on a WP multisite network. User are added to the main blog as Subscribers.
I changed the Test Member’s role to AnsPress Participant and it still didn’t work, so I think those roles are not a factor as I initially thought.