Support » Fixing WordPress » ajax comment post validation return json

  • I’m sending the comment form with ajax to it’s default action domain/wp-comments-post.php and it returns a 500 error page.

    What I want is to validate the form and return a json with invalid inputs => error message association json. If form input is valid try to add comment, if not added return error json, if added return comment => rendered li element association json.

    The question is NOT javascript related, is wordpress related.

    Don’t know how else to explain it better.
    Thanx for your time.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Is there no solution for my problem?

    Moderator kmessinger


    Does this apply?
    WordPress 3.2 required PHP 5.2.4 or later, class-json.php was included for compatibility with older versions of PHP only. It was removed here:

    Unfortunately, Your theme will need to be updated, you may find that simply commenting out the include line will allow it to continue working if it was using the PHP json functions like any well built theme would have been.

    Alternatively, Copy the json file into your themes folder, and modify the include line to reference the themes folder instead of WordPress’s.

    I have wordpress 3.2, all system requirements fulfilled. The theme was made by me (no plugins used), from scratch. The question is still the same. How can I do the above?

    @kmessinger you answer didn’t help. My problem didn’t work before since was not implemented, I want to implement it now. And what line commenting are you talking about? What json file? I don’t know what are you talking about.

    Moderator kmessinger


    @kmessinger you answer didn’t help.

    Ahh yes, well you get what you pay for. :^)

    Does the server support json?

    Run this,


    Why are you talking rubbish? Of course it does.
    Did you read my question?

    I’ll rephrase it: send comment form with ajax, validate the form return error as json or on success return the comment (actual LI element with whatever else it contains) in the json so I can updated the comments list (OL). How do I do that?

    In this freakin’ codex there is no example on how to use ajax with your wordpress. Or I must be blind.



    Forum Moderator

    It might be better if you diverted some of your energy away from abusing volunteers who are trying to help you and into doing some of your own searching:

    I start to think that most here on forums don’t understand English or don’t know how to read.

    @esmi: who did I abuse and with what? Please read my question again.

    And again: after submitting my comment using ajax how do I return the results as json? How do I handle ajax request? There is not a single line about this in the codex!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘ajax comment post validation return json’ is closed to new replies.