Comments ajax issue

Solved3.62K viewsIssues

Hi, I’m stuck from days on this issue.

i’ve adapted anspress to my theme using override.css method here:

however i’ve a bug on comments that happens only with this theme unfortunately:

When i post a comment the ajax POST call works but it doesn’t close the editor showing the comment. But if i refresh the page my comment is displayed.

I’ve no javascript errors in console, so could you help me to find the incompatibility issue please? i’ve debugged a lot using web tools, but unsuccesfully

EDIT1: i’ve noticed that data parameter passed to ajax function only receives “success” as string. It’s not an array as it should be

edited question

After dozen of hours spent to debugging i’ve found the solution.

In few words my theme adds comment_post action doing such instructions:

if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
case "0":
case "1": //Approved comment

i had to debug thousands rows of code to find this, but finally i found it. Now i’m using remove_action core function to remove that hook under anspress pages.

PS. is there a better method to find such issues in you opinion?

thank you

commented on answer

Hello Yehonal,
Thanks for getting back to us. I did not fully understood your issue. A video will be helpful. But if already solved for you then no need.