JavaScript - Comment.Save

Last updated on
30 April 2025

You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules

// #### 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

Help improve this page

Page status: Not set

You can: