title: Laravel 4 - pass parameter in controller, through ajax to view
body: <p>In my application, I call a function named checkProject, in my controller.  I do this via getJSON. I understand the use of append to display content from my response data, however I need to use the values to populate a javascript function within my blade view.</p>
  
  <p>Is it possible to do this through sessions?  Is there another way I can pass this data through?</p>
  
  <p>PROJECT CONTROLLER</p>
  
  <pre><code>public function getProject()
  { 
   $input = Input::get('option');
   $projects = Project::where('id', $input)-&gt;get();
  
   return Response::json($projects);
   // can session be set here?    
  }
  </code></pre>
  
  <p>PROJECT.BLADE.PHP </p>
  
  <p>This has getJSON which calls api/getproject which routes to the project controller function above.  Below is the Json call and the secondary JS function which needs to populate the values minTime and maxTime</p>
  
  <pre><code>$.getJSON("{{ url('api/getproject')}}", { option: $(this).val() }, 
   function(data) 
   {                    
   if (data.success != false ) { 
     $.each(data, function(key, value) {
         $('#open').append('&lt;div&gt;' + value.weekday_start_time +', ' + value.title +'&lt;/div&gt;');
     });
   }
  }); 
  
  var logic = function( currentDateTime ){
          if( currentDateTime.getDay()==6 ){ 
             this.setOptions({
                 minTime:'10:00',
                 maxTime:'21:00'
             });
           } else 
               this.setOptions({
                 minTime:'08:00',
                 maxTime:'22:00'
             });
          };
   });
  </code></pre>