mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
Make AJAX requests on activity page POST not GET
See parent commit for the reason we’re doing this. Currently our AJAX requests only work as `GET` requests. So this commit does a bit of work to make them work as `POST` requests. This is optional behaviour, and will only happen when the element in the page that should be updated with AJAX has the `data-form` attribute set. It will take the form that has the corresponding `id`, serialise it, and use that data as the body of the post request. If not form is specified it will not do the serialisation, and submit as a `GET` request as before.
This commit is contained in:
@@ -24,9 +24,9 @@
|
||||
method="post"
|
||||
action="{{ url_for('.view_notifications', service_id=current_service.id, message_type=message_type) }}"
|
||||
class="grid-row"
|
||||
id="search-form"
|
||||
>
|
||||
<div class="column-three-quarters">
|
||||
<input type="hidden" name="status" value="{{ status }}">
|
||||
{{ textbox(
|
||||
search_form.to,
|
||||
width='1-1',
|
||||
@@ -41,8 +41,9 @@
|
||||
|
||||
{{ ajax_block(
|
||||
partials,
|
||||
url_for('.get_notifications_as_json', service_id=current_service.id, message_type=message_type, status=status, page=page, to=to),
|
||||
'notifications'
|
||||
url_for('.get_notifications_as_json', service_id=current_service.id, message_type=message_type, status=status, page=page),
|
||||
'notifications',
|
||||
form='search-form'
|
||||
) }}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user