Answers for "send post request using form"

9

send post request form javascript

let data = {element: "barium"};

fetch("/post/data/here", {
  method: "POST", 
  body: JSON.stringify(data)
}).then(res => {
  console.log("Request complete! response:", res);
});


// If you are as lazy as me (or just prefer a shortcut/helper):

window.post = function(url, data) {
  return fetch(url, {method: "POST", body: JSON.stringify(data)});
}

// ...

post("post/data/here", {element: "osmium"});
Posted by: Guest on March-04-2020
0

post form data

@if($errors->any())                           /*  This 
@foreach($errors->all() as $error)                area is 
  {{ $error }}<br>                                to print
@endforeach                                       message in
@endif                                            the form     */
<form method="post" action="submitmyform">	
       {{ csrf_field()}}               // csrf token
	<p>
		<label>Name</label>
		<input type="text" name="name" value="{{ old("name")}}"/>
	</p>
     <p>
     <label>Email</label>
		<input type="text" name="email" value="{{ old("email")}}"/>	
     </p>
	<p>
     <label>Age</label>
		<input type="text" name="age" value="{{ old("age")}}"/>	
     </p>
      <p>
      	<input type="submit" name="Submit">
      </p>
</form>
Posted by: Guest on May-25-2021

Code answers related to "send post request using form"

Code answers related to "Javascript"

Browse Popular Code Answers by Language