Skip to:
Content

BuddyPress.org

Opened 13 years ago

Closed 9 years ago

Last modified 9 years ago

#4966 closed enhancement (wontfix)

Activity Post Form ajax submit enhancement

Reported by: megainfo Owned by:
Priority: normal Milestone:
Component: Templates Version: 1.2
Severity: normal Keywords:
Cc:

Description

It would be great if you change the submit ajax code to give posibility to developer to send more input fileds

why not send serialize the form ?

the actual code,

		jq.post( ajaxurl, {
			action: 'post_update',
			'cookie': encodeURIComponent(document.cookie),
			'_wpnonce_post_update': jq("input#_wpnonce_post_update").val(),
			'content': content,
			'object': object,
			'item_id': item_id,
			'_bp_as_nonce': jq('#_bp_as_nonce').val() || ''
		},

To :

       jq.post( ajaxurl, {
			action: 'post_update',
			'data' :   $("#whats-new-form").serialize(),
			'cookie': encodeURIComponent(document.cookie),
			'_wpnonce_post_update': jq("input#_wpnonce_post_update").val(),
			'_bp_as_nonce': jq('#_bp_as_nonce').val() || ''
		},

I think this will give more flexibility and enhancement.

thanks.

Change History (6)

#1 @r-a-y
13 years ago

  • Component ActivityTheme
  • Milestone Awaiting ReviewFuture Release
  • Version1.2

I think this is a very, good point; we need to do a better job for plugin devs to grab their form values so they can do whatever.

However, depending on how many fields are in the form and how long the form values are, this could create a very long querystring, which could lead to a "414 Long Request" error. See #4606 as another example of this.

You could try using jQuery's ajaxSend() event handler:
http://api.jquery.com/ajaxSend/

It's a bit more work because you have to do this in your plugin, but see if that works.

#2 @r-a-y
12 years ago

cyrilbatillat mentions tracking #WP21170.

#3 @henry.wright
12 years ago

One thing I like about .serialise() is how it isn't dependent on class names. Quite often I notice in the forum, users modify DOM elements adding their own classes and IDs and wonder why Ajax functionality breaks. They're less likely to modify input names

Version 0, edited 12 years ago by henry.wright (next)

#4 @DJPaul
10 years ago

  • Component Appearance - Template PartsTemplates

#5 @DJPaul
9 years ago

  • Milestone Future Release
  • Resolutionwontfix
  • Status newclosed

Closing most tickets related to BP-Default and BP-Legacy, since the upcoming BP-Nouveau template pack (planned for 3.0) will make these redundant.

#6 @DJPaul
9 years ago

Closing most tickets related to BP-Default and BP-Legacy, since the upcoming BP-Nouveau template pack (planned for 3.0) will make these redundant.

Note: See TracTickets for help on using tickets.