title: Passing values in laravel through AJAX
body: <p>Iam trying to connect my database and admin panel by passing some data through it.</p>
  
  <p>My controller looks like
  // Getting State data for display in editing mdoal via AJAX</p>
  
  <pre><code>public function getblogdata(Request $request){
      $bloglists   = DB::table("bloglists")
      -&gt;select(DB::raw("*"))
      -&gt;where('bloglists.id' , '=', $request-&gt;uid)
      -&gt;get();
      // $country = unserialize(base64_decode($bloglists[0]-&gt;country));
      // return response()-&gt;json( $country);
      // return response()-&gt;json( $bloglists, $country);
      return response()-&gt;json( $bloglists);
  }
  </code></pre>
  
  <p>Note: I tried to pass multiple variables here but could not. Finally settled for one variable only.</p>
  
  <p>My Ajax looks like </p>
  
  <pre><code>$('.edit_blog_btn').on('click', function () {
          var blog_sel = $(this).data('uid');
          // console.log($(this).data('uid'));
          if (blog_sel) {
              $.ajax({
                  type: "GET",
                  url: "/get_blog_data?uid="+blog_sel, 
                  dataType: "json",
                  success: function (res) {     
                      // console.log(res);
                      if(res){
                          $.each(res, function (key, value){
                              $("#blog-edit-title").val(value.title);
                              $("#blog-edit-c_img").empty();
                              $("#blog-edit-c_img").append('&lt;span&gt;Cover Image - &lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;img src="/storage/cover_images/'+value.cover_img+'" alt=" " class="img-responsive" id="blog-edit-c_img"/&gt;&lt;input name="cover_img" type="file"&gt;');
                              $("#blog-edit-url").val(value.url);
                              var country = res[0]['country'];
                              var state = res[0]['state'];
                              var sight = res[0]['sight'];
                              var tags = res[0]['tags'];
                              console.log("the country tag is " + country+ "the state tags is " +state+ "the sight tag is "+sight+ "tha tag tag is" +tags );
  
                          });                            
                      } else {
                          alert('Something weird just happened');
                      }
                  }
              });
          } else {
              $("#blog-id").empty();
          }
      });
  </code></pre>
  
  <p>Note: I simply want pass the 4 variables along with other data to show in view</p>