Support the ongoing development of →
Requests Database Forms
Last updated 3 months ago.

jimgwhit said:


thank you I know it but i want to know laravel 5 can handle it ? or i must write it?


Have you looked for a jquery solution, laravel is a php framework. But jquery works well with laravel. or have a drop down without ajax.

Last updated 7 years ago.

don't mess with, rather learn how to use jquery ajax. You'll be happier in the end.


jimgwhit said:

don't mess with, rather learn how to use jquery ajax. You'll be happier in the end.

please tell me a more clear answer,i couldn't what do you say.

for another example when i login i don't want to refresh all page i want to refresh top menu

Last updated 7 years ago.

If you are new to this, practice first, take a while to learn jquery. Short of that try phprunner, it will generate code for you. Laravel is a php framework where you should already be well versed in php, pdo, HTML, and jquery or JavaScript.


I haven't used a dropdown, but I use a popup lookup table, so here is a example: In my edit page I "lookup" the owner:

edit page partial
<td class="aright">ownerid:</td>
<input type="text" name="ownerid" id="ownerid" value="<?php echo $data->ownerid;?>">
echo '<a href="JavaScript:void(0);" onclick="Lookup()">Click Me</a>';
//use \helpers\session as Session;

Javascript to open the popup window to have the table to select owner from:

code to open popup
function Lookup() {
    var iMyWidth;
    var iMyHeight;
    //half the screen width minus half the new window width (plus 5 pixel borders).
    iMyWidth = (window.screen.width / 2) - (250 + 10);
    //half the screen height minus half the new window height (plus title and status bars).
    iMyHeight = (window.screen.height / 2) - (250 + 50);
    //Open the window.
    //var map ="/mvc/owner", "map", "status=no,height=500,width=500,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
    var map ="findowner", "map", "status=no,height=500,width=500,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
controller code for find owner
public function findowner()
        //include 'mypager2.php';
        include 'mypager2.php';
            $t1 = $_REQUEST['t1'];
            $t1 = "";
        $ownersearch = $t1;
        $ownersearch = $ownersearch . "%";
        $krows = DB::table('powners')->where('oname', 'like', $ownersearch)->count();
        $pages = new Mypager2('5','page');
        //echo $krows;
        //echo $pages->get_perpage();
        $data['owners'] = DB::table('powners')
                        ->where('oname', 'like', $ownersearch)
                        ->orderBy('oname', 'asc')
       $data['page_links'] = $pages->page_links('?','&t1='.$t1);
       //$mpage = $pages->page_links('?','&t1='.$t1);
       //echo $mpage;
	//echo $data['page_links'];	
        //$owners = DB::select('select * from powners'); //good works
        return View::make('owner/findowner')->with('data',$data['owners'])->with('data2',$data['page_links']);
the findowner and jquery code to get the owner
<script type="text/javascript" src="include/jquery.js"></script>
<script type="text/javascript" src="include/myjq.js"></script>
<link rel="stylesheet" href="include/style2.css" type="text/css">

echo "<br>";

//echo "<div id=tblcont2>";
		'<table id="myTable" border="1"  align="left" cellpadding="6" cellspacing="0">'.
		'<thead style="background-color:lightblue">'.	

foreach ($data as $owner){
    //echo $owner['oname'];//works with ORM also
    //echo $owner->oname; //use with database and querybuilder and ORM
    echo "<tr>";
    echo "<td>"."<a href=\"\" >".$owner->ownerid."</a>"."</td>";
    echo "<td>"."<a>".$owner->oname."</a>"."</td>";
    echo "<td>"."<a>".$owner->ostreet."</a>"."</td>";
    echo "<td>"."<a>".$owner->odate."</a>"."</td>";
    echo "<td>"."<a>".$owner->ocheck."</a>"."</td>";
    echo "</tr>";

echo "</table>";
echo "<br>";
echo '<table style="width:70%;">';
echo '<tr>';
echo '<td>' . $data2 . '</td>';

echo '</tr></table>';	

//echo "</div>";
//echo $data2;
//echo "<p>{$data2}</p>";
//echo 'hi';



$(function() {

$("#myTable td:nth-child(1)").click(function(event)
var $td= $(this).closest('tr').children('td');
var currentCellText = $td.eq(0).text();
var CellText = $td.eq(1).text();
  url:'<?php echo "getowner";?>',
  type: 'GET',
  data: 'id='+currentCellText,
  dataType: 'json',
  success: function(data) {
 if(data.ocheck == '1')
    	window.opener.$('#ocheck').attr('checked', true);
		 window.opener.$('#ocheck').attr('checked', false); 

});// JavaScript Document

});  ///end function


controller for get owner, this has no view, returned directly from controller, and fills the 3 fields.
public function getowner(){
           $ownerid = $_GET['id'];
           return Response::json($data['owners']);
Last updated 7 years ago.


I know php , html and A little jquery and javascript but I want to know laravel 5 has those featcures that I said?if yes how can use it?


Read my example, you have to use jquery etc, that's how to implement. Laravel isn't going to write the code for you. You have to include jquery, and program the code yourself. Read my example above, I showed you I I rolled up my sleeves and actually implemented some jquery ajax. My example is in laravel 4, I haven;t done this in L5 yet.
Again laravel is a php framework, you have to include jquery just like you would in php.

Last updated 7 years ago.


really thank you very much ;) you are very very good friend :) really thank you


Sign in to participate in this thread!


Your banner here too?

k00r0sh k00r0sh k00r0sh Joined 14 Sep 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.