title: laravel 4 how to show result at the same page and how to solve circle invoke
body: <p>I am totally new to laravel, I am now want to use laravel 4.</p>
  
  <p>Suppose I have a page A.php, and it contains a form &amp; a submit button. After I submit the post request to B.php, and in B.php I query data from database. </p>
  
  <p>My question is I want to show my result on B.php , that it is to say the same page of A.php request, how do I write in routes.php.</p>
  
  <p>My code:
  master.blade.php</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
     &lt;head&gt;
         &lt;metacharset="UTF-8"&gt;
         &lt;title&gt;course query&lt;/title&gt;
     &lt;/head&gt;
     &lt;body&gt;
          &lt;div class="container"&gt;
              @yield('container')
          &lt;/div&gt;
  
          &lt;h1 class="ret"&gt;The result is:
              @yield('ret')
              &lt;input id="result" type="text"/&gt;
          &lt;/h1&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>A.php</p>
  
  <pre><code>@extends('course.master')
  
  @section('container')
      &lt;h1&gt;My Courses&lt;/h1&gt;
      {{Form::open(array('url' =&gt; 'csOp'))}}
          {{Form::label('course', 'Your course')}}
          {{Form::text('course')}}
          {{Form::submit('Submit')}}
      {{Form::close()}}
  @endsection
  </code></pre>
  
  <p>routes.php</p>
  
  <pre><code>Route::get('course', function(){
      return View::make('course.B');
  });
  
  Route::post('csOp', function(){
      // do something
      //$inputCourse = Input::get('course');    
      //$records = Courses::where('name', '=', $inputCourse)-&gt;get();
  
      // how do I return
      //return View::make('csOp', $records);
  });
  </code></pre>
  
  <p>As you can see, in A.php I have a form and request to <code>csOp</code></p>
  
  <pre><code>Form::open(array('url' =&gt; 'csOp')
  </code></pre>
  
  <p>csOp is B.php, and in B.php I query data from db, and now I got the results,
  but how can I put result to the page (B.php) itself? That it is to say I want to put the result to </p>
  
  <pre><code>&lt;input id="result" type="text"/&gt;
  </code></pre>
  
  <p>You know in jquery is easy, how do I use it in laravel 4 ?</p>
  
  <p>And if return to csOp, absolutlly will get an error, it is in a  circle. So how can I solve it ?</p>
  
  <p>Thanks very much.</p>