Reputation: 1540
I need to submit a form and include some custom http headers with the request (the API requires them).
Something like jQuery.ajax() works great (https://api.jquery.com/jQuery.ajax/), I can use the beforeSend arg to compose some headers.
However I need this for a synchronous request, to direct the browser to the destination of the form. So one of the following two would work, but I'm not sure if a solution exists.
Have JS create and submit a form. How do I include custom http headers in a form?
Find an equivalent function to jQuery.ajax(), that will submit a synchronous request.
Upvotes: 1
Views: 317
Reputation: 113
jQuery.ajax
has a property async
which can be set to true
or false
.
async false would make it a synchronous request.
Upvotes: 1