WordPress.org

Ready to get started?Download WordPress

Forums

ajax comment post + validation + return json (8 posts)

  1. gurde
    Member
    Posted 3 years ago #

    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.

  2. gurde
    Member
    Posted 3 years ago #

    Is there no solution for my problem?

  3. kmessinger
    Volunteer Moderator
    Posted 3 years ago #

    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: http://core.trac.wordpress.org/changeset/17603

    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.

    http://wordpress.org/support/topic/troubleshooting-wordpress-32-master-list?replies=7

  4. gurde
    Member
    Posted 3 years ago #

    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.

  5. kmessinger
    Volunteer Moderator
    Posted 3 years ago #

    @kmessinger you answer didn't help.

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

    Does the server support json?

    Run this,

    <?php
     phpinfo();
    ?>
  6. gurde
    Member
    Posted 3 years ago #

    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.

  7. esmi
    Forum Moderator
    Posted 3 years ago #

    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: http://codex.wordpress.org/Function_Reference/wp_enqueue_script

  8. gurde
    Member
    Posted 3 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic