php - can i open my own dialog box within javascript and pass value object? -
i want run dialog box code , pass value object it. when click link value object passed correctly. if there way call div ="#mymodel" , pass value it.
<!-- modal --> <div class="modal fade" id="mymodal" role="dialog"> <div class="modal-dialog"> <!-- modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="btn btn-default" style='float: right;' data-dismiss="modal"><span class="glyphicon glyphicon-remove-circle"></span></button> <a href="#" class="btn btn-default" style='float: right;'> <span class="glyphicon glyphicon-trash"></span> </a> <a href="#" class="btn btn-default" style='float: right;'> <span class="glyphicon glyphicon-pencil"></span> </a> <h4 class="modal-title">basl officers details {{ $basl_officer }} </h4> </div> <!-- text input --> <div class="modal-body"> {!! form::label('o_code', 'officers code: '); !!} {!! form::text('officers_code', null, ['class' => 'form-control', 'id' => 'officers_code','disabled' => 'disabled']); !!} {!! form::label('o_name', 'officers name: '); !!} {!! form::text('officers_name', null, ['class' => 'form-control', 'id' => 'officers_name','disabled' => 'disabled']); !!} </div> </div> </div> </div>
javascript code
<script type="text/javascript"> function showdata(x) { // console.log(x); alert('you clicked top text' + x['code']); $("#mymodal").dialog({ autoopen: true }); } </script>
please kindly expect possible.this code in same page.
////////////////////full code///////////////////////////////////////////
@extends('layouts.app') @section('slide_bar') @include('layouts.master_entry_slide_bar') @endsection @section('content') <section class="content-header"> <h1>basl officers <small>page </small></h1> </section> <br/> <!-- main content --> <section class="content fluid"> <div class="row"> <div class="box"> <div class="gap"> <div class="box-body"> <table id="example1" class="table table-bordered table-striped"> <col width='auto'> <col width='auto'> <col width='100'> <thead> <tr> <th>basl officers code</th> <th>basl officers name</th> <th><p id='buttons'> <a href="{{ route('basl_officers_page.create')}}" class="btn btn-success"> <strong> add new officers   </strong> <span class="glyphicon glyphicon-plus"></span> </a> </p></th> </tr> </thead> <tbody> @foreach ($basl_officers $basl_officer) <tr > <td><a href="#" data-toggle="modal" data-target="#mymodal">{{ $basl_officer->code }} </a></td> <td><a href="#" onclick="showdata({{ json_encode($basl_officer) }})">{{ $basl_officer->officername }} </a></td> <td align='center'> {!! form::open(['method' => 'delete', 'route'=>['basl_officers_page.destroy',$basl_officer->id]]) !!} <a href="{{route('basl_officers_page.edit',$basl_officer->id)}}" class="btn btn-default btn-sm"> <span class="glyphicon glyphicon-pencil"></span> </a>     <button type="submit" class="btn btn-default btn-sm" onclick="return confirm('are sure?')"> <span class="glyphicon glyphicon-trash"></span> </button> {!! form::close() !!} </td> </tr> @endforeach </tbody> <tfoot> <tr> <th>basl officers code</th> <th>basl officers name</th> <th></th> </tr> </tfoot> </table> </div><!-- /.box-body --> </div><!-- /.box --> </div> </div><!-- /.row --> </section><!-- /.content --> <!-- modal --> <div class="modal fade" id="mymodal" role="dialog"> <div class="modal-dialog"> <!-- modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="btn btn-default" style='float: right;' data-dismiss="modal"><span class="glyphicon glyphicon-remove-circle"></span></button> <a href="#" class="btn btn-default" style='float: right;'> <span class="glyphicon glyphicon-trash"></span> </a> <a href="#" class="btn btn-default" style='float: right;'> <span class="glyphicon glyphicon-pencil"></span> </a> <h4 class="modal-title">basl officers details {{ $basl_officer }} </h4> </div> <!-- text input --> <div class="modal-body"> {!! form::label('o_code', 'officers code: '); !!} {!! form::text('officers_code', null, ['class' => 'form-control', 'id' => 'officers_code','disabled' => 'disabled']); !!} {!! form::label('o_name', 'officers name: '); !!} {!! form::text('officers_name', null, ['class' => 'form-control', 'id' => 'officers_name','disabled' => 'disabled']); !!} </div> </div> </div> </div> <script> var name = document.getelementbyid("master_entry"); document.getelementbyid("master_entry").classname = "active"; var slide_bar_element = document.getelementbyid("bd_menu"); document.getelementbyid("bd_menu").classname = "active"; var slide_bar_element = document.getelementbyid("bd_submenu1"); document.getelementbyid("bd_submenu1").classname = "active";</script> <script type="text/javascript"> function showdata(x) { $("#mymodal").dialog({ autoopen: true }); } </script> @endsection
Comments
Post a Comment