#4966 closed enhancement (wontfix)
Activity Post Form ajax submit enhancement
Reported by: | 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
@
11 years ago
- Component changed from Activity to Theme
- Milestone changed from Awaiting Review to Future Release
- Version set to 1.2
#3
@
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
Note: See
TracTickets for help on using
tickets.
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.