Skip to:
Content

BuddyPress.org

Opened 11 years ago

Closed 7 years ago

Last modified 7 years ago

#4966 closed enhancement (wontfix)

Activity Post Form ajax submit enhancement

Reported by: megainfo's profile megainfo Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.2
Component: Templates 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
11 years ago

  • Component changed from Activity to Theme
  • Milestone changed from Awaiting Review to Future Release
  • Version set to 1.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
10 years ago

cyrilbatillat mentions tracking #WP21170.

#3 @henry.wright
10 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. Users are less likely to modify input names

Last edited 10 years ago by henry.wright (previous) (diff)

#4 @DJPaul
8 years ago

  • Component changed from Appearance - Template Parts to Templates

#5 @DJPaul
7 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

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
7 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.