Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to do a dynamic search. When the user enters characters into a input field, results comeback from the model. I am not getting the results back using this code:

//here is my HTLML:
<input type='text' placeholder='Search By Email' class='searchterm' > 

//here is my jQuery:
$(".searchterm").keyup(function(e){
  var q = $(".searchterm").val();
  $.getJSON("searchpeeps",
  {
    q: q,
  },
  function(data) {
    $("ul.peepList").empty();
    $("ul.peepList").append(" Results for <b>" + q + "</b>");
    $.each(data.query.search, function(i,item){
      $("ul.peepList").append("<li>"++"</li>");
    });
  });
 });


//here is my get route:
Route::get('searchpeeps/{q}', array('as' => 'searchpeeps', 'uses' => 'PeopleController@searchpeeps'));


//here is my controller:
    public function searchpeeps($id)
    {

        $uid = Auth::user()->id;
        //$q = Input::get('q');
        return Invite::where('email', $id)
        ->where('user_id', $uid)    
        ->orderBy("created_at", "desc")
        ->groupBy('email')
        ->get(); 
    }
share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.