Community Documentation

JavaScript - Comment.Save

Last updated May 20, 2010. Created by yajnin on May 3, 2010.
Edited by heyrocker. Log in to edit this page.

// #### COMMENT.SAVE

// Releases
// // # SERVICES 6.x-2.0 and JSON SERVER 6.x-2.0-alpha1

// + + Comment Object

var comment_object = {

    "nid": 123, // Required, set appropriately
    "comment": "Hello World!", // Required

    "cid": 0, // Set to 0, or do not include for new comment // For edit, set CID appropriately
    "subject": "My comment", // Do not include for blank subject
    "uid": 1  // Do not include for anonymous comment

};

// + + Data Object

// This data object is the instruction between your Drupal Services Server
// // Example of how to implement this is in the next code box below

var data: {
  "method": "comment.save",
  "comment": comment_object
};

// #### Calling the Request

JSON
http://drupal.org/node/522942

JSONP
http://drupal.org/node/791922

// #### Reference: Services & JavaScript

JavaScript - Node.Save & Edit // Cross-method Insights
http://drupal.org/node/774116

JavaScript - CCK Fields in the Node Object // Cross-method Insights
http://drupal.org/node/776122

JavaScript - Comment.Save
http://drupal.org/node/788892

JavaScript - JSON Server // Request.JSON (MooTools Example)
http://drupal.org/node/522942

JavaScript - JSON Server // Request.JSONP (MooTools Example)
http://drupal.org/node/791922

Page status

No known problems

Log in to edit this page

About this page

Drupal version
Drupal 6.x

Develop for Drupal

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.