#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
@
13 years ago
- Component Activity → Theme
- Milestone Awaiting Review → Future Release
- Version → 1.2
#3
@
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
(next)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.