Showing posts with label php. Show all posts
Showing posts with label php. Show all posts
jquery conflict issue in php

jquery conflict issue in php

Solution 1 :

    Open your jquery.js file and add this to the very bottom of it: jQuery.noConflict();
   
Solution 2 :

    jQuery(function($){
    // Use jQuery with $(...)

        $('#mySelector').hide();

        /* your jquery code....*/

    });

Solution 3 :

    var test = {};
    test.query = jQuery.noConflict( true );
   

How to Add Active Class to a Navigation Menu Based on URL using PHP

How to Add Active Class to a Navigation Menu Based on URL using PHP
<div class="page-content">
    <div class="row">
        <div class="col-md-2">
            <div class="sidebar content-box" style="display: block;">
                <ul class="nav">
                    <?php $page_name=b asename($_SERVER[ 'PHP_SELF']); ?>
                    <!-- Main menu -->
                    <li class="<?php echo ($page_name=='dashboard.php')?'current':'';?>"><a href="dashboard.php"><i class="glyphicon glyphicon-home"></i> Dashboard</a>
                    </li>

                    <li class="submenu <?php echo ($page_name=='welcome_note.php' || $page_name=='corporate_profile.php' || $page_name=='introduction_of_the_township.php' || $page_name=='location_map.php')?'current open':'';?>">
                        <a href="#">
                            <i class="glyphicon glyphicon-list"></i> Pages
                            <span class="caret pull-right"></span>
                        </a>
                        <!-- Sub menu -->
                        <ul>
                            <li class="<?php echo ($page_name=='welcome_note.php')?'current':'';?>"><a href="welcome_note.php">Welcome Note</a>
                            </li>
                            <li class="<?php echo ($page_name=='corporate_profile.php')?'current':'';?>"><a href="corporate_profile.php">Corporate Profile</a>
                            </li>
                            <li class="<?php echo ($page_name=='introduction_of_the_township.php')?'current':'';?>"><a href="introduction_of_the_township.php">The Township</a>
                            </li>
                            <li class="<?php echo ($page_name=='location_map.php')?'current':'';?>"><a href="location_map.php">Location Map</a>
                            </li>

                        </ul>
                    </li>
                    <li class="<?php echo ($page_name=='consultants.php')?'current':'';?>"><a href="consultants.php"><i class="glyphicon glyphicon-move"></i>Consultants</a>
                    </li>
                    <li class="<?php echo ($page_name=='suppliers.php')?'current':'';?>"><a href="suppliers.php"><i class="glyphicon glyphicon-gift"></i>Suppliers</a>
                    </li>

                    <li class="submenu <?php echo ($page_name=='main_contractor.php' || $page_name=='sub_contractor.php')?'current open':'';?>">
                        <a href="#">
                            <i class="glyphicon glyphicon-list-alt"></i>Contractor
                            <span class="caret pull-right"></span>
                        </a>
                        <!-- Sub menu -->
                        <ul>
                            <li class="<?php echo ($page_name=='main_contractor.php')?'current':'';?>"><a href="main_contractor.php">Main-Contractor</a>
                            </li>
                            <li class="<?php echo ($page_name=='sub_contractor.php')?'current':'';?>"><a href="sub_contractor.php">Sub-Contractor</a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>

Pass id value from a href to bootstrap modal php

Pass id value from a href to bootstrap modal php
Pass id value from a href to bootstrap modal php
<!-- Edit Modal -->

<div class="modal fade" id="myModalNorm1" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <!-- Modal Header -->
            <div class="modal-header">
                <button type="button" class="close"
                   data-dismiss="modal">
                       <span aria-hidden="true">&times;</span>
                       <span class="sr-only">Close</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    Edit CONSULTANTS
                </h4>
            </div>
           
            <!-- Modal Body -->
            <div class="modal-body">
                <div class="fetched-data"></div>
            </div>
          
        </div>
    </div>
</div>
<!-- End Modal -->

Javascript


<script>
$(document).ready(function(){
    $('#myModalNorm1').on('show.bs.modal', function (e) {
        var rowid = $(e.relatedTarget).data('id');
        $.ajax({
            type : 'post',
            url : 'fetch_record.php', //Here you will fetch records
            data :  'rowid='+ rowid, //Pass $id
            success : function(data){
            $('.fetched-data').html(data);//Show fetched data from database
            }
        });
     });
});
</script>

fetch_record.php


<?php include 'include/config.php';
if($_REQUEST['rowid']) {
    $con_id = $_REQUEST['rowid']; //escape string
    $sql_content1="select * from list_of_consultants where consultants_id='$con_id'";
    $sql_content_res1=mysql_query($sql_content1);
    $content_data=mysql_fetch_array($sql_content_res1);
   
   
    echo "<form method='POST'>
                  <div class='form-group'>
                    <label for='exampleInputEmail1'>Consultants Name</label>
                   
                      <input type='text' class='form-control'
                      id='exampleInputEmail1' name='conname' value='".$content_data['consultants_name']."' placeholder='Consultants Name'/>
                  </div>
                 
                  <div class='form-group'>
                    <label for='exampleInputEmail1'>Address(Title)</label>
                      <input type='text' class='form-control'
                      id='exampleInputEmail1' name='addtitle' value='".$content_data['consultants_address_title']." ' placeholder='Address(Title)'/>
                  </div>
                  <div class='form-group'>
                    <label for='exampleInputEmail1'>Address</label>
                      <textarea placeholder='Address' name='address' class='form-control'>".$content_data['consultants_address']."</textarea>
                  </div>
                  <div class='form-group'>
                    <label for='exampleInputEmail1'>Telephone No</label>
                      <input type='text' class='form-control'
                      id='exampleInputEmail1' name='telno' value='".$content_data['consultants_telephone']."' placeholder='Telephone No'/>
                  </div>
                  <div class='form-group'>
                    <label for='exampleInputEmail1'>Residence No</label>
                      <input type='text' class='form-control'
                      id='exampleInputEmail1' name='resino' value='".$content_data['consultants_recedence']."' placeholder='Residence No'/>
                  </div>
                  <input type='hidden' name='c_id' value='".$content_data['consultants_id']."'/>
                  <input type='submit'  class='btn btn-primary' name='consult_update' value='Update'/>
                    <button type='button' class='btn btn-default'
                            data-dismiss='modal'>
                                Close
                    </button>
                
                </form>";
 }
?>

Access-Control-Allow-Origin

 
Access-Control-Allow-Origin
Solution No 1


 <?php
 header('Access-Control-Allow-Origin: *'); 
 -------
 ------
 -------
 your code
 --------
 ?>

 Solution No 2


 <?php

 header('content-type: application/json; charset=utf-8');
 header("access-control-allow-origin: *");

 ?>

Solution No 3


<?php
    header('Content-type: text/html');
    header('Access-Control-Allow-Origin: *');
?>

Kategori

Kategori