SHARE
TWEET

Untitled

a guest Jul 17th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <div class="w3-row">
  2.     <div class="w3-col w3-center">
  3.         <form name="my_form" id="my_form">
  4.             <input type="text" name="foo" value="12345gfd">
  5.             <input type="text" name="bar" value="1234sdfghjzt5gfd">
  6.             <button type="button" id="foobutton">doit</button>
  7.         </form>
  8.     </div>
  9. </div>
  10. <script type="application/javascript">
  11.     $(function () {
  12.         $('#foobutton').click(function () {
  13.             let formData = new FormData(window.document.forms.namedItem('my_form'));
  14.             let data = {};
  15.             formData.forEach((key, value) => data[key] = value);
  16.             $.ajax({
  17.                 url: '/lerp-product-product/a536d460-5791-4338-bb32-507fc7958264',
  18.                 method: 'put',
  19.                 data: data,
  20.                 processData: false, // wegen FormData
  21.                 contentType: false, // wegen FormData
  22.                 success: function (data, textStatus, jqXHR) {
  23.                     console.log('yeah, back from PUT');
  24.                 }
  25.             });
  26.         });
  27.     });
  28. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top