[buddypress-trac] [BuddyPress Trac] #5822: Extending ajax parameters

buddypress-trac noreply at wordpress.org
Tue Aug 19 16:01:23 UTC 2014


#5822: Extending ajax parameters
---------------------------+------------------------------
 Reporter:  cyrilbatillat  |       Owner:
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Activity       |     Version:  2.0
 Severity:  normal         |  Resolution:
 Keywords:                 |
---------------------------+------------------------------

Comment (by henry.wright):

 Perhaps the {{{.serialize()}}} method could be utilised here?

 For example:

 {{{
 var ajaxdata = {
     action: 'new_activity_comment',
     'cookie': bp_get_cookies(),
     '_wpnonce_new_activity_comment':
 jq("#_wpnonce_new_activity_comment").val(),
     'string': jq( "#form" ).serialize()
 };
 }}}

 Then in whatever function is hooked to {{{new_activity_comment}}} you can
 do stuff like:

 {{{
 $params = array();
 parse_str( $_POST['string'], $params );
 echo $params['comment_id']; // or whatever etc
 echo $params['content']; // or whatever etc
 echo $params['form_id']; // or whatever etc
 }}}

 This way, if users make changes to the comment form input fields, they can
 access their custom data.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5822#comment:1>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list