Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- <script
- src="https://code.jquery.com/jquery-3.2.1.min.js"
- integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
- crossorigin="anonymous"></script>
- </head>
- <body>
- <script type="text/javascript">
- $(document).ready( function () {
- $("#submit").submit( function(){
- var name = $("#name").val();
- console.log(name);
- $.ajax({
- type: "POST",
- url : "{{url('/search')}}",
- data : name ,
- success : function(data)
- {
- console.log(data)
- },
- error : function(error)
- {
- console.log(error)
- }
- });
- });
- });
- </script>
- <div class="col-md-6 offset-3">
- <form id="submit" method="POST">
- <input type="name" name="name" id="name">
- <button type="submit" class="btn btn-success">search</button>
- </form>
- </div>
- </body>
- </html>
- Route::post('/search/{name}', 'HomeController@in');
- public function in()
- {
- return json("fdfdfdfdfdf");
- }
Add Comment
Please, Sign In to add comment