Saving new entry via Ajax then immediately showing it I’ve created a very simple comments system whereby comments are set us a channel, with each (comment )entry related to a main entry from another section. Works fine. I’ve set up editing and deleting the comment via Ajax, but I’m stuck on saving it.
I’ve got the form submitting successfully via ajax, but I want to be able to display it immediately after it is saved/posted.
The successful response I get gives me the author username, entry id, date etc, but not the actual comment field. I also need to display additional user details.

I’m not quite sure on best way to tackle this. Just looking for a pointer in the right direction. Cheers!
Use that as your controller, this is the craft default controller actionSaveEntry that you use right now with a few changes. You can access it in Javascript when you use action: "pluginHandle/entry/saveEntry".

namespace Craft;

class EntryController extends BaseController
{

    /**
     * @var    bool|array Allows anonymous access to this controller's actions.
     * @access protected
     */
    protected $allowAnonymous = array('actionSaveEntry');


    /**
     * Saves an entry.
     *
     * @return null
     */
    public function actionSaveEntry()
    {
        // craft default things.. this is actually the exact same function
        // like you call at the moment, it does the same..
        // just go to the part where I have the !Important! note
        $this-&gt;requirePostRequest();

        $entry = $this-&gt;_getEntryModel();

        // Permission enforcement
        $this-&gt;enforceEditEntryPermissions($entry);
        $userSessionService = craft()-&gt;userSession;
        $currentUser = $userSessionService-&gt;getUser();

        if ($entry-&gt;id) {
            // Is this another user's entry (and it's not a Single)?
            if (
                $entry-&gt;authorId != $currentUser-&gt;id &amp;&amp;
                $entry-&gt;getSection()-&gt;type != SectionType::Single
            ) {
                if ($entry-&gt;enabled) {
                    // Make sure they have permission to make live changes to those
                    $userSessionService-&gt;requirePermission('publishPeerEntries:' . $entry-&gt;sectionId);
                }
            }
        }

        // Populate the entry with post data
        $this-&gt;_populateEntryModel($entry);

        // Even more permission enforcement
        if ($entry-&gt;enabled) {
            if ($entry-&gt;id) {
                $userSessionService-&gt;requirePermission('publishEntries:' . $entry-&gt;sectionId);
            } else if (!$currentUser-&gt;can('publishEntries:' . $entry-&gt;sectionId)) {
                $entry-&gt;enabled = false;
            }
        }

        // Save the entry (finally!)
        // !Important! so this is where your action starts
        if (craft()-&gt;entries-&gt;saveEntry($entry)) {
            $return['success'] = true;
            $return['id'] = $entry-&gt;id;
            $return['title'] = $entry-&gt;title;

            // after saving the entry you can render your template
            // the documentation can be found here https://craftcms.com/docs/plugins/templates
            // just read this site and you'll know what to do.. 
            // this allows you to render your "comments" template like when you 
            // visit the page the first initially
            // you'll just do $("#idOfYourCommentsContainer").append(ajaxResponse['html']);
            // and thats it^^ 
            // in the template you have access to the variables $entry =&gt; the new entry
            // and the user currently.. if you need something else, feel free to ask
            $return['html'] = $this-&gt;renderTemplate('/path/to/template', array(
                'entry' =&gt; $entry,
                'user' =&gt; $entry-&gt;getAuthor()
            ));

            $return['authorUsername'] = $entry-&gt;getAuthor()-&gt;username;
            $return['dateCreated'] = DateTimeHelper::toIso8601($entry-&gt;dateCreated);
            $return['dateUpdated'] = DateTimeHelper::toIso8601($entry-&gt;dateUpdated);
            $return['postDate'] = ($entry-&gt;postDate ? DateTimeHelper::toIso8601($entry-&gt;postDate) : null);

            $this-&gt;returnJson($return);
        } else {
            if (craft()-&gt;request-&gt;isAjaxRequest()) {
                $this-&gt;returnJson(array(
                    'errors' =&gt; $entry-&gt;getErrors(),
                    'success' =&gt; false
                ));
            }
        }
    }
}


If there is an error you get the array with all "mistakes" and error messages. For example if you define the field "headline" as required and the user didn't insert something in the "headline" field your response will be

reponse = [
    "error" =&gt; [
        'headline'  =&gt; [
            'The Headline field is required //or something like that...'
        ]
    ]
];


You could select the headline field by name or class with javascript and append the error message as well