Topic: jQuery

PHP AJAX Live Search Box Autocomplete Using MySQL Database 0

PHP AJAX Live Search Box Autocomplete Using MySQL Database

Today, We want to share with you PHP AJAX Live Search Box Autocomplete Using MySQL Database.In this post we will show you PHP Jquery AJAX Live Search Box Using MySQL, hear for PHP MySQL Live Search Box using Jquery Ajax Example we will give you demo and example for implement.In this post, we will learn about Jquery Ajax Live Search Box using PHP MySql with an example.

PHP AJAX Live Search Box Autocomplete Using MySQL Database

There are the Following The simple About PHP AJAX Live Search Box Autocomplete Using MySQL Database Full Information With Example and source code.

As I will cover this Post with live Working example to develop ajax live data search using jquery php mysql, so the some major files and Directory structures for this example is following below.

  • index.php
  • fetch.php

Step 1: Creating the Database Table

— Database: `member_list` >> — Table structure for table `member_tbl`

CREATE TABLE IF NOT EXISTS `member_tbl` (
  `MemberID` int(11) NOT NULL AUTO_INCREMENT,
  `MemberName` varchar(250) NOT NULL,
  `member_addr` text NOT NULL,
  `member_city` varchar(250) NOT NULL,
  `member_pcode` varchar(30) NOT NULL,
  `member_country` varchar(100) NOT NULL,
  PRIMARY KEY (`MemberID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ;

Step 2: Dumping data On Table

Dumping data for table `member_tbl`

//ajax live data search using jquery php mysql
INSERT INTO `member_tbl` (`MemberID`, `MemberName`, `member_addr`, `member_city`, `member_pcode`, `member_country`) VALUES
(1, 'Jaydeep Gondaliya', 'sejal Str. 57', 'Berlin', '12209', 'Germany'),
(2, 'Ankit Kathiriya', 'Avda. de la Ram park 2222', 'USA D.F.', '5021', 'USA'),
(3, 'Krunal Sisodiya', 'sardha 2312', 'USA D.F.', '5475', 'USA'),
(4, 'chirag dethariya', '120 dsp salon Sq.', 'London', 'WA1 1DP', 'UK'),
(5, 'Dhaval dave', 'Rua do Ganesh, 12', 'Resende', '56458-363', 'UEA'),
(6, 'Pooja solanki', 'ul. astha 68', 'Walla', '01-658', 'Poland'),
(7, 'Bhakti Banugariya', 'kavya 45', 'Helsinki', '2853', 'India'),
(8, 'Nilesh chandvadiya', '305 - 14th Ave. S. Suite 3B', 'Seattle', '98128', 'USA'),
(9, 'Hitesh Ajani', 'Rua do Ganesh, 12', 'Resende', '098952-363', 'UEA'),
(10, 'Mayur Dhameliya', 'bhakti 38', 'Oulu', '321452', 'India'),
(11, 'Stavan Patel', '2, rue du chandni', 'Reims', '350024', 'France'),
(12, 'Parag shukla', '722 Titupati Blvd.', 'Kirkland', '360002', 'USA'),
(13, 'Vijay bhanderi', 'Bhavanath. 48', 'Butte', '225010', 'USA');

Step 3: Creating the Search Form

index.php

This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as index.php.

 
  
  <title>PHP AJAX Live Search Box Autocomplete Using MySQL Database</title>
  
  
  
 
 
  <div class="pakainfo container">
   <br />
   <h2 align="center">PHP AJAX Live Search Box Autocomplete Using MySQL Database</h2>
   
   <b>Simple ajax live data search using jquery php mysql</b><br />
   <div class="pakainfo form-group">
    <div class="input-group pakainfo">
     <span class="input-group-addon pakainfo">Search</span>
     
    </div>
   </div>
   <br />
   <div id="result"></div>
  </div>
 


$(document).ready(function(){

 ajax_data_load();

 function ajax_data_load(query)
 {
  $.ajax({
   url:"fetch.php",
   method:"POST",
   data:{query:query},
   success:function(data)
   {
    $('#result').html(data);
   }
  });
 }
 $('#query_search').keyup(function(){
  var search = $(this).val();
  if(search != '')
  {
   ajax_data_load(search);
  }
  else
  {
   ajax_data_load();
  }
 });
});

Step 4 : Processing Search Query in Backend

fetch.php for PHP AJAX Live Search Box Autocomplete server side source code

 0)
{
 $output .= '
  <div class="pakainfo table-responsive">
   <table class="table table bordered">
    <tr>
     <th>Member Name</th>
     <th>member Address</th>
     <th>member_city</th>
     <th>Member Post Code</th>
     <th>member_country</th>
    </tr>
 ';
 while($memres = mysqli_fetch_array($result))
 {
  $output .= '
   <tr>
    <td>'.$memres["MemberName"].'</td>
    <td>'.$memres["member_addr"].'</td>
    <td>'.$memres["member_city"].'</td>
    <td>'.$memres["member_pcode"].'</td>
    <td>'.$memres["member_country"].'</td>
   </tr>
  ';
 }
 echo $output;
}
else
{
 echo 'Data Not Found';
}

?>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP AJAX Live Search Box Autocomplete Using MySQL Database.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Chosen Ajax Autocomplete Textbox using jQuery, PHP 0

Chosen Ajax Autocomplete Textbox using jQuery, PHP and MySQL

Today, We want to share with you Chosen Ajax Autocomplete Textbox using jQuery, PHP and MySQL.In this post we will show you Autocomplete Textbox using jQuery, PHP and MySQLi, hear for Ajax PHP MySQL Creating Autocomplete Search Suggestion we will give you demo and example for implement.In this post, we will learn about PHP Autocomplete Input tags with Dynamic Data using jquery Ajax
with an example.

Chosen Ajax Autocomplete Textbox using jQuery, PHP and MySQL

There are the Following The simple About Chosen Ajax Autocomplete Textbox using jQuery, PHP and MySQL Full Information With Example and source code.

As I will cover this Post with live Working example to develop Jquery Chosen plugin – dynamically populate list by Ajax, so the PHP – Jquery Chosen Ajax Autocomplete for this example is following below.

Step 1: Make a MySQL Database Table

Lest start, I want to make MySQL database and table, therefor here i made “products” database and “products” table with product id as well as product name column. We can simply make MySQL “products” table as following simple sql query.

SQL Query:

CREATE TABLE IF NOT EXISTS `products` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=24 ;

Step 2: Make index.php

Now, I want to make simple root PHP index.php file as well as i made form with one HTML input text box using jquery chosen. I also some easy source code for multiple add more fields in jquery examples. therefor let’s make simple index.php file and put some bellow source code.

index.php

<!DOCTYPE html>
<html>
<head>
  <title>jQuery Chosen autocomplete with PHP and AJAX - pakainfo.com</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" />

 
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.css" />
  <script src="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
</head>
<body>

<h1>jQuery Chosen autocomplete with PHP and AJAX</h1> 
<div class="container pakainfo">
  <div class="pakainfo panel panel-primary">
    <div class="panel-heading">jQuery Chosen autocomplete with PHP and AJAX - pakainfo.com</div>
    <div class="panel-body pakainfo">
      <form>
        <select class="form-control pakainfo select-box">
          <option>Select Products</option>
        </select>
      </form>
    </div>
  </div>
</div>
 
<script type="text/javascript">
  $(".select-box").chosen();
 
  $('.chosen-search input').autocomplete({
    source: function( request, response ) {
      $.ajax({
        url: "request_ajax.php?name="+request.term,
        dataType: "json",
        success: function( data ) {
          $('.select-box').empty();
          response( $.map( data, function( product ) {
            $('.select-box').append('<option value="'+product.id+'">' + product.name + '</option>');
          }));
          $(".select-box").trigger("chosen:updated");
        }
      });
    }
  });
</script>
 
</body>
</html>

Step 3: Create request_ajax.php File

In this Last step, I shall simple source code for fetching PHP jquery ajax data from MySQL database using simple mysql query. Therefor We have to make a simple request_ajax.php and put bellow some source code:

request_ajax.php

<?php
    
    $hostName = "localhost";
    $username = "root";
    $password = "jaydeepGondaliya";
    $dbname = "products";
 
    $mysqli = new mysqli($hostName, $username, $password, $dbname); 
    $sql = "SELECT * FROM products WHERE name LIKE '%".$_GET['name']."%'"; 
    $all_result = $mysqli->query($sql);
 
    $data_response = [];
    while($row = mysqli_fetch_assoc($all_result)){
       $data_response[] = array("id"=>$row['id'], "name"=>$row['name']);
    } 
    echo json_encode($data_response);
 
?>

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Chosen Ajax Autocomplete Textbox using jQuery, PHP and MySQL.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Dropzone php mysql Example with Demo 0

Simple Dropzone php mysql Example with Demo

Today, We want to share with you Dropzone php mysql Example with Demo.In this post we will show you Dropzone Multiple Image upload validation, hear for Laravel Dropzonejs Multiple File Upload using jQuery we will give you demo and example for implement.In this post, we will learn about DropzoneJS send additional data Multiple File Upload with an example.

Simple Dropzone php mysql Example with Demo

There are the Following The simple About Simple Dropzone php mysql Example with Demo Full Information With Example and source code.

As I will cover this Post with live Working example to develop filestack – DropZone Allowed File Extensions Tutorials, so the How to display existing files on server in Dropzone js using PHP for this example is following below.

Create Index.php File:

<!DOCTYPE html>
<html>
<head>
    <title>jQuery Ajax Dropzone display uploaded files on server PHP - Pakainfo.com</title>
    <script src="jquery/3.3.1/jquery.min.js"></script>
    <link href='dropzone/5.4.0/dropzone.css' type='text/css' rel='stylesheet'>
    <script src='dropzone/5.4.0/dropzone.js' type='text/javascript'></script>
    <style type="text/css">
      .dz-preview .dz-image img{
        width: 100% !important;
        height: 100% !important;
        object-fit: cover;
      }
    </style>
</head>
<body>
  
<div class="container pakainfo" >
  <h1>jQuery Ajax Dropzone display uploaded files on server in PHP <BR/> Pakainfo.com</h1>
  <div class='content'>
    <form action="do_multipleFilesUplodad.php" class="dropzone" >  
    </form> 
  </div> 
</div>
  
<script type="text/javascript">
  Dropzone.autoDiscover = false;
  $(".dropzone").dropzone({
    init: function() { 
      liveDropzone = this;
      $.ajax({
        url: 'do_multipleFilesUplodad.php',
        type: 'post',
        data: {request: 'get_request'},
        dataType: 'json',
        success: function(response){
  
          $.each(response, function(key,value) {
            var mockFile = { name: value.name, size: value.size};
  
            liveDropzone.emit("addedfile", mockFile);
            liveDropzone.emit("thumbnail", mockFile, value.path);
            liveDropzone.emit("complete", mockFile);
  
          });
  
        }
      });
    }
  });
</script>
  
</body>
</html>

Create Index.php File:

<?php
  
/* Upload PHP To directory Moves*/
$finalDirdata = "upload/";
  
$destination_path = "upload";
if(isset($_POST['request'])){
  $request = $_POST['request'];
}
  
/* Upload file */
if($destination_path == "upload"){
  $msg = "";
  if (move_uploaded_file($_FILES["file"]["tmp_name"], $finalDirdata.$_FILES['file']['name'])) {
    $msg = "Successfully uploaded";
  }else{ 
    $msg = "Error while uploading";
  }
  echo $msg;
  exit;
}
  
/* Read files from */
if($request == 'get_request'){
  $allFiles = [];
  
  $is_dir = $finalDirdata;
  if (is_dir($is_dir)){
    if ($dh = opendir($is_dir)){
      while (($file = readdir($dh)) !== false){
        if($file != '' && $file != '.' && $file != '..'){
          $file_path = $finalDirdata.$file;
          if(!is_dir($file_path)){
             $size = filesize($file_path);
             $allFiles[] = ['name'=>$file, 'size'=>$size, 'path'=>$file_path];
          }
        }
      }
      closedir($dh);
    }
  }
  
  echo json_encode($allFiles);
  exit;
}

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Simple Dropzone php mysql Example with Demo.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Vue js Toggle switch Update DB field using Ajax 0

Vue js Toggle switch Update DB field using Ajax

Today, We want to share with you Vue js Toggle switch Update DB field using Ajax.In this post we will show you Toggle Switches Laravel, Ajax and jQuery example, hear for Laravel Bootstrap Toggle switch Update DB field using Ajax
we will give you demo and example for implement.In this post, we will learn about Bootstrap Toggle Inside JQuery DataTable with an example.

Vue js Toggle switch Update DB field using Ajax

There are the Following The simple About Vue js Toggle switch Update DB field using Ajax Full Information With Example and source code.

As I will cover this Post with live Working example to develop Laravel 5.7 Toggle switch Update DB field using Ajax, so the Vue js Toggle Like Dislike Rating System using jQuery Ajax for this example is following below.

Step 1: Make a Vue JS App

In this step, I want to make vue cli app using bellow simple command:

vue create vueSwitch

Step 2: Install vue-js-toggle-button package

Now I want to install simple step by step vue-js-toggle-button npm package for vue js Bootstrap Toggle switch Update DB field using Ajax.

npm install vue-js-toggle-button --save

Step 3: Use vue-js-toggle-button

I want to use vue-js-toggle-button package in main.js file of vue js app.

src/main.js

import Vue from 'vue'
import App from './App.vue'
import ToggleButton from 'vue-js-toggle-button'
Vue.config.productionTip = false
Vue.use(ToggleButton)
new Vue({
  render: h => h(App),

}).$mount('#app')

Step 4: Update App.vue File

In this step, I want to update app.vue file, because i updated simple component therefor.

src/App.vue

<template>
  <div id="app">
    <Product></Product>
  </div>
</template>
<script>
import Product from './components/Product.vue'
export default {
  name: 'app',
  components: {
    Product
  }
}
</script>
[/php

<h3>Step 5: Create Product Component</h3>
<p>Here, we will create Product.vue component with following source code.</p>
<b>src/components/Product.vue</b>
[php]
<template>
  <div class="container pakainfo" style="text-align:center">
    <div class="large-12 medium-12 small-12 cell">
      <h1 style="font-family:arial">Vue js toggle button example - Infinityknow.com</h1>
  
        <toggle-button @change="onChangeEventHandler" :labels="{checked: 'On', unchecked: 'Off'}" style="margin-left: 20px" />
  
        <toggle-button :labels="{checked: 'Infinityknow.com', unchecked: 'pakainfo.com'}" width="250" style="margin-left: 20px" />
  
        <toggle-button :labels="{checked: 'Yes', unchecked: 'No'}" style="margin-left: 20px" />
  
    </div>
  </div>
</template>
<script>
  export default {
    data(){
      return {
        file: ''
      }
    },
  
    methods: {
      onChangeEventHandler(){
          alert('Welcome To Pakainfo.com Shop website');
      }
    }
  }
</script>

Last step, I can run vue js live app by using following simple below command:

npm run serve

Get more info for Toggle Switches Laravel, Ajax and vuejs example from here: https://www.npmjs.com/package/vue-js-toggle-button.

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Vue js Toggle switch Update DB field using Ajax.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Basic Computer Programming Languages Principles 0

Basic Computer Programming Languages Principles

Today, We want to share with you Basic Computer Programming Languages Principles.
In this post we will show you Programming principles, hear for The Principles Of Good Programming we will give you demo and example for implement.
In this post, we will learn about Basic Programming Principles Every Programmer Must Follow with an example.

Overview

Programming principles have helped me over the years in becoming a better programmer and developer, and I also believe, this article will help every developer become more efficient and able to produce code which is easier to maintain. By following these coding and programming principles, you can save development and maintenance time, and conquer lots of other congestion which may arise in later development phases.

What are Programming principles?

Programming is the complete process, which involves various stages such as coding, testing, debugging and maintaining a system.Programming principles assist you to write good quality of code and maintain a good coding practice.

Why should a developer follow it?

Actually, writing programs is mostly a matter of personal taste but there are certain rules or guidelines that should be followed within your style of code in order to make programs easy to maintain and understand by both, you and others(your team), and also principles guide the creation of Optimized, scalable, easy to maintain, and robust code.

What are the benefits if developer follows Programming principles?

Readability

All developers which are in a team of project able to understand the code.

Extensibility

In the Software world, changes are needed on time to time, If we have followed rule properly then it will become very easy to implement new changes in software.

Maintainability

It becomes easy to maintain by the development team and the production support team too because the application is loosely coupled.

Modularity

Make a whole program into small reusable pieces: functions, modules, libraries,union, structures.

Conclusion

  • You should write a program that is self-explanatory.
  • Use Comment wherever required, It makes documentation easy.
  • You should write a code which should be easy to maintain among your team.
jQuery 15 Powerful Tips and Tricks for Developers and Web Designer

Apart from this properly written program would also be easy to debug.
These principles will help you and others in the team to write or deliver good, clean, and high-quality code.

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Computer Programming Principles.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

DataTables Checkbox Check All Example 0

DataTables Checkbox Check All Example

Today, We want to share with you DataTables Checkbox Check All Example.In this post we will show you datatables check if checkbox is checked, hear for jquery datatable checkbox header select all we will give you demo and example for implement.In this post, we will learn about select multiple rows with checkboxes using jquery datatable with an example.

DataTables Checkbox Check All Example

There are the Following The simple About DataTables Checkbox Check All Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop jquery datatable multi select checkbox, so the datatables checkbox select all ajax for this example is following below.

Step 1: HTML Table

<table class="table table-striped" id="student_list">
 <thead><tr>
 <th><span class="hide"> - </span><div class="checkbox check_all_students_wrap">
<input type="checkbox" id="check_all_students" data-to-table="tasks"><label></label></div></th>
 <th>Student Name</th>
 <th>Online Status</th>
 <th>Options</th>
 </tr></thead>
 <tbody></tbody>
</table>

Step 2: Disable jQuery Sorting

$('#student_list').dataTable( {
        "columnDefs": [ {
          "targets": [0],
          "orderable": false,
    } ]
} );

And then, here is the source code to select all the checkbox using jQuery DataTable when table main header part to checkbox checked.

jQuery DataTable Checkbox Select All

$('body').on('change', '#check_all_students', function() {
   var stud_row, checked;
   stud_row = $('#student_list').find('tbody tr');
   checked = $(this).prop('checked');
   $.each(stud_row, function() {
      var checkbox = $($(this).find('td').eq(0)).find('input').prop('checked', checked);
   });
 });

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about DataTables Checkbox Check All Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

DataTable Custom Filter Server Side Examples 0

DataTable Custom Filter Server Side

Today, We want to share with you DataTable Custom Filter Server Side.In this post we will show you Datatables custom filtering with server side, hear for Add Server-side DataTables Custom Filter using PHP with Ajax we will give you demo and example for implement.In this post, we will learn about Implement custom multicolumn server-side filtering in jQuery dataTables with an example.

DataTable Custom Filter Server Side

There are the Following The simple About DataTable Custom Filter Server Side Full Information With Example and source code.

As I will cover this Post with live Working example to develop Add custom Filter for server side Processing, so the Create Custom Dropdown Server Side Filter in Datatables for this example is following below.

HTML Table Source Code

<table class="list bordered highlight" id="MerchantCatalogs">
 <thead><tr> <th> <?php echo _("Reference"); ?> </th> <th> <?php echo _("Customer Name"); ?> </th> <th> <?php echo _("Invoice Date"); ?></th> <th> <?php echo _("Due Date"); ?></th> <th> <?php echo _("Amount"); ?> </th> <th> <?php echo _("Yet To Receive"); ?></th><th> <?php echo _("Status"); ?></th> </tr></thead>
 </table>

JS Source Code

ToReceiveTable = $("#MerchantCatalogs").dataTable({
 "processing": true,
 "serverSide": true,
 "order": [[ 6, "asc" ]],
 "pageLength": 50, 
 "ajax": "<?php echo get_url(); ?>ajax?MerchantCatalogs=yes"
 });

The Above one is ordinary ServerSide Processing DataTable code.

And then make a jQuery drop down within the datatable.

ToReceiveTable = $("#MerchantCatalogs").dataTable({
 "processing": true,
 "serverSide": true,
 "order": [[ 6, "asc" ]],
 "pageLength": 50,
 "dom": '<"ProductFilterCatalog">frtip',
 "ajax": "<?php echo get_url(); ?>ajax?MerchantCatalogs=yes"
 });
 $("div.ProductFilterCatalog").html('<label> Filter Status : <select name="ProductFilterCatalog" id="ProductFilterCatalog"> <option value="-1" > All </label>');

And then write the jQuery DataTable Refresh when member selects a filter option from the drop down which we Data added.

 $("#ProductFilterCatalog").on("change", function(){ 
    var FilterVal = $(this).val(); 
    var new_getURL = "<?php echo get_url(); ?>ajax?MerchantCatalogs=yes&FilterStatus="+FilterVal;
    ToReceiveTable.api().ajax.url(new_getURL).load();
 });

Now, we have to create a jQuery Ajax file to handle the request to server Side process.

if(isset($_GET['MerchantCatalogs']) && $_GET['MerchantCatalogs'] == 'yes'){
	
	$sql_details = array( 
		 'member' => 'kvcodes',
		 'pass' => '[email protected]',
		 'db'   => 'demo_db',
		 'host' => 'localhost'
		); 
	$table = 'customer_trans';
	$primaryKey = 'id';
	
	$columns = array(
		array( 'db' => '`so`.`friends_ref`',  'dt' => 0,	'field' => 'friends_ref' ),
		array( 'db' => '`debtor`.`name`',  	'dt' => 1,	'field' => 'name'),
		array( 'db' => '`so`.`display_dt`',	'dt' => 2,	'field' => 'display_dt','formatter' => function( $d, $row ) 	{ return date( 'jS M y', strtotime($d)); } ),
		array( 'db' => '`so`.`notify_dt`',   'dt' => 3,	'field' => 'notify_dt', 'formatter' => function( $d, $row ) 	{ return date( 'jS M y', strtotime($d)); } ),
		array( 'db' => '`so`.`product_amt`',  'dt' => 4,	'field' => 'product_amt'),
		array( 'db' => '`so`.`alloc`',  	'dt' => 5,	'field' => 'alloc'),
		array( 'db' => '`so`.`status`',   'dt' => 6,	'field' => 'status')
	);

	$joinQuery = "FROM `{$table}` AS `so`";  
	$additionalWhere = '';
	if(isset($_GET['FilterStatus'])){
			if($_GET['FilterStatus'] == 'Received'){
					$additionalWhere .= " AND status= 2 ";
			}elseif($_GET['FilterStatus'] == 'Overdue'){
					$additionalWhere .=" AND status = 1";
			}elseif($_GET['FilterStatus'] == 'Yet To Receive' ){
					$additionalWhere .=" AND status=3";
			}
	}
	
	$wigepa_sources = Master_Table::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery , $additionalWhere, '',  'yes' );
	echo json_encode($wigepa_sources);
}

CSS Part

.ProductFilterCatalog { float: left; text-align: left; }
.ProductFilterCatalog select { padding: 7px; border-color: #3d3d3d; }

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about DataTable Custom Filter Server Side.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

JQuery Push Key And Value Into An Array 0

JQuery Push Key And Value Into An Array

Today, We want to share with you JQuery Push Key And Value Into An Array.In this post we will show you javascript array push key value pair dynamically, hear for how to push both key and value into an array in javascript we will give you demo and example for implement.In this post, we will learn about Push Both Key And Value Into An Array In JQuery with an example.

JQuery Push Key And Value Into An Array

There are the Following The simple About JQuery Push Key And Value Into An Array Full Information With Example and source code.

As I will cover this Post with live Working example to develop create array with key and value in jquery, so the javascript push object into array with key for this example is following below.

Push Both Key And Value Into An Array using JQuery

var teacher_details_arr = [{ index: 5, name: 'Jaydeep' },{ index: 2, name: 'Ankit' },{ index: 3, name: 'pakainfo'},{ index: 4, name: 'Krunal'}]; 

var student_details_arr = new Array();  // Empty here student_details_arr array for our use.

And then, I am going to simple copy this first jquery array values to second array , and then I am going to use simple javascript push method to source code copy pure js Index and name both simple things.

$.each(teacher_details_arr, function (index, value) {
      student_details_arr.push({name: value.name,  index:  value.index});
}); // Here I just exchange data the location of the main objects.

$.each(student_details_arr, function (index, value) {
    alert({"name: "+value.name +" and index: "+ value.index});
}); // Here I just exchange data the location of the simple objects.

From the above source code results like this simple result.

name: Jaydeep and index : 5

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about JQuery Push Key And Value Into An Array.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

jQuery Ajax CRUD operations in Laravel 5.7 0

jQuery Ajax CRUD operations in Laravel 5.7

Today, We want to share with you jQuery Ajax CRUD operations in Laravel 5.7.In this post we will show you ajax crud operations in laravel 5.7 with modal & pagination, hear for Laravel 5.7 Ajax CRUD with Pagination example and demo from scratch we will give you demo and example for implement.In this post, we will learn about Laravel 5.7 Ajax CRUD example for web application without page refresh with an example.

jQuery Ajax CRUD operations in Laravel 5.7

There are the Following The simple About jQuery Ajax CRUD operations in Laravel 5.7 Full Information With Example and source code.

As I will cover this Post with live Working example to develop Ajax CRUD example in Laravel 5.7 application, so the laravel 5.7 ajax update database for this example is following below.

Step 1: Install Laravel 5.7

Run the below Laravel command to install laravel Latest version Like Laravel 5.7,

Composer create-project --prefer-dist laravel/laravel crud

Step 2: Setup MySQL Database Configuration

We can do all the database setup step by step configuration on .env file.

Step 3: Create Table

Comment to create table,

php artisan make:migration create_products_table --create=product

Now, Go to path “database/migrations” and here We can simple change the migration file of product table,

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateproductsTable extends Migration
{
    public function up()
    {
        Schema::create('products', function(Blueprint $table)
        {
            $table->increments('id');
            $table->string('name');
            $table->string('description');
            $table->timestamps();
        });
    }
    public function down()
    {
        Schema::dropIfExists('products');
    }
}
 

After that we can Use the below PHP artisan command to migrate.

php artisan migrate

Step 4: Creating Laravel 5.7 Controller

Run the below simple command to create a Laravel controller as well as Laravel model,

php artisan make:controller ProductController --resource --model=Model/Product

We can display the created Laravel controller Path on “app/Http/Controllers/”

Step 5: Define a Laravel Routes

And then, We simple Run the following PHP artisan command to include the routes inside the file name web.php file of routes folder.

Route::resource('product','ProductController');

Step 6: Make a Laravel Default Methods In Product Controller

  • Index()
  • Create()
  • Store()
  • Show()
  • Edit()
  • Update()
  • Destroy()

Above All the Laravel methods are the default methods in ProductController

Step 7: Write The source Code For Laravel 5.7 CRUD Operation

And then We can display the All step by step process of CRUD operation in Laravel 5.7,

<?php
namespace App\Http\Controllers;
use App\Model\Product;
use Illuminate\Http\Request;
class ProductController extends Controller {
    public function index() {
        $products = Product::latest()->paginate(5);
        return view('products.index', compact('products'))->with('i', (request()->input('page', 1) - 1) * 5);
    }
    public function create() {
        return view('products.create');
    }
    public function store(Request $request) {
        $request->validate(['name' => 'required', 'description' => 'required', ]);
        Product::create($request->all());
        return redirect()->route('products.index')->with('success', 'product created successfully.');
    }
    public function show(Product $Product) {
        return view('products.show', compact('product'));
    }
    public function edit(Product $Product) {
        return view('products.edit', compact('product'));
    }
    public function update(Request $request, Product $Product) {
        $Product->validate(['name' => 'required', 'description' => 'required', ]);
        $product->update($request->all());
        return redirect()->route('products.index')->with('success', 'product updated successfully');
    }
    public function destroy(Product $Product) {
        $Product->delete();
        return redirect()->route('products.index')->with('success', 'product deleted successfully');
    }
}

Step 8: making a blade files In Laravel 5.7

We have Total 5 blade files,

  • Layout.blade.php
  • Index.blade.php
  • Create.blade.php
  • Edit.blade.php
  • Show.blade.php

Layout.blade.php

<!DOCTYPE html>
<html>
  <head>
    <title>Welcome To Pakainfo.com</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.css" rel="stylesheet">
  </head>
  <body>
    <div class="container">
      @yield('content')
    </div>
  </body>
</html>

Index.blade.php

@extends('product.layout')
@section('content')
<div class="row">
  <div class="col-lg-12 margin-tb">
    <div class="pull-left">
      <h2>Welcome
      </h2>
    </div>
    <div class="pull-right">
      <a class="btn btn-success" href="{{ route('products.create') }}"> Create New product
      </a>
    </div>
  </div>
</div>
@if ($message = Session::get('success'))
<div class="alert alert-success">
  <p>{{ $message }}
  </p>
</div>
@endif
<table class="table table-bordered">
  <tr>
    <th>Slno
    </th>
    <th>Name
    </th>
    <th>description
    </th>
    <th width="280px">Action
    </th>
  </tr>
  @foreach ($products as $product)
  <tr>
    <td>{{ ++$i }}
    </td>
    <td>{{ $product->name }}
    </td>
    <td>{{ $product->description }}
    </td>
    <td>
      <form action="{{ route('products.destroy',$product->id) }}" method="POST">
        <a class="btn btn-info" href="{{ route('products.show',$product->id) }}">Show
        </a>
        <a class="btn btn-success" href="{{ route('products.edit',$product->id) }}">Edit
        </a>
        @csrf
        @method('DELETE')
        <button type="submit" class="btn btn-danger">Delete
        </button>
      </form>
    </td>
  </tr>
  @endforeach
</table>
{!! $products->links() !!}
@endsection

Create.blade.php

@extends('products.layout')
@section('content')
<div class="row">
  <div class="col-lg-12 margin-tb">
    <div class="pull-left">
      <h2>Add New product
      </h2>
    </div>
    <div class="pull-right">
      <a class="btn btn-success" href="{{ route('products.index') }}"> Back
      </a>
    </div>
  </div>
</div>
@if ($errors->any())
<div class="alert alert-danger">
  <strong>Whoops!
  </strong> There were some problems with your input.
  <br>
  <br>
  <ul>
    @foreach ($errors->all() as $error)
    <li>{{ $error }}
    </li>
    @endforeach
  </ul>
</div>
@endif
<form action="{{ route('products.store') }}" method="POST">
  @csrf
  <div class="row">
    <div class="col-xs-12 col-sm-12 col-md-12">
      <div class="form-group">
        <strong>Name:
        </strong>
        <input type="text" name="name" class="form-control" placeholder="Name">
      </div>
    </div>
    <div class="col-xs-12 col-sm-12 col-md-12">
      <div class="form-group">
        <strong>Detail:
        </strong>
        <input type="text" name="description" class="form-control" placeholder="description">
      </div>
    </div>
    <div class="col-xs-12 col-sm-12 col-md-12 text-center">
      <button type="submit" class="btn btn-success">Submit
      </button>
    </div>
  </div>
</form>
@endsection

Edit.blade.php

@extends('products.layout')
@section('content')
<div class="row">
  <div class="col-lg-12 margin-tb">
    <div class="pull-left pakainfo">
      <h2>Edit product
      </h2>
    </div>
    <div class="pull-right pakainfo">
      <a class="btn btn-success" href="{{ route('products.index') }}"> Back
      </a>
    </div>
  </div>
</div>
@if ($errors->any())
<div class="alert alert-danger">
  <strong>Whoops!
  </strong> There were some More problems with your input.
  <br>
  <br>
  <ul>
    @foreach ($errors->all() as $error)
    <li>{{ $error }}
    </li>
    @endforeach
  </ul>
</div>
@endif
<form action="{{ route('products.update',$product->id) }}" method="POST">
  @csrf
  @method('PUT')
  <div class="row">
    <div class="col-xs-12 col-sm-12 col-md-12">
      <div class="form-group pakainfo">
        <strong>Name:
        </strong>
        <input type="text" name="name" value="{{ $product->name }}" class="form-control" placeholder="Name">
      </div>
    </div>
    <div class="col-xs-12 col-sm-12 col-md-12">
      <div class="form-group pakainfo">
        <strong>Detail:
        </strong>
        <input type="text" name="description" value="{{ $product->description }}" class="form-control" placeholder="description">
      </div>
    </div>
    <div class="col-xs-12 col-sm-12 col-md-12 text-center">
      <button type="submit" class="btn btn-success">Submit
      </button>
    </div>
  </div>
</form>
@endsection

Show.blade.php

@extends('products.layout')
@section('content')
<div class="row pakainfo">
  <div class="col-lg-12 margin-tb">
    <div class="pull-left">
      <h2> Show product
      </h2>
    </div>
    <div class="pull-right pakainfo">
      <a class="btn btn-success" href="{{ route('products.index') }}"> Back
      </a>
    </div>
  </div>
</div>
<div class="row">
  <div class="col-xs-12 col-sm-12 col-md-12">
    <div class="form-group pakainfo">
      <strong>Name:
      </strong>
      {{ $product->name }}
    </div>
  </div>
  <div class="col-xs-12 col-sm-12 col-md-12">
    <div class="form-group pakainfo">
      <strong>Details:
      </strong>
      {{ $product->description }}
    </div>
  </div>
</div>
@endsection

Last step You can Run the below php artisan command to run this project the local server

php artisan serve

Now We can display my local browsers server successfully running here http://localhost:8000/products

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about jQuery Ajax CRUD operations in Laravel 5.7.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Bootstrap Toggle Inside JQuery DataTable 0

Bootstrap Toggle Inside JQuery DataTable

Today, We want to share with you Bootstrap Toggle Inside JQuery DataTable.In this post we will show you Bootstrap Switch / Toggle – examples, hear for bootstrap 4 toggle switch jQuery DataTables we will give you demo and example for implement.In this post, we will learn about How To Display Bootstrap Toggle Switch with DataTables via Render with an example.

Bootstrap Toggle Inside JQuery DataTable

There are the Following The simple About Bootstrap Toggle Inside JQuery DataTable Full Information With Example and source code.

Laravel Bootstrap Toggle switch Update DB field using Ajax

As I will cover this Post with live Working example to develop jQuery Datatable toggle filter, so the some major files and Directory structures for this example

Toggle Switches Laravel, Ajax and jQuery example

is following below.

DataTable Bootstrap Toggle

 <table id="saved-members-table" class="display responsive nowrap table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr><th><?php echo $global['client_name'];?></th> 
     <th><?php echo $global['phone'];?></th>
     <th>PC. No</th>
     <th>Membership Type</th>
     <th>Status</th>
 </tr>
</thead>
</table>

Laravel Toggle Switch Inside Bootstrap Ajax Example

HTML Part

<input id="live-toggle-example" type="checkbox" checked data-toggle="toggle" data-on="Active" data-off="Due" data-onstyle="success" data-offstyle="warning">

jQuery('#live-toggle-example').bootstrapToggle();

Laravel 5.7 Toggle switch Update DB field using Ajax

And then, the jQuery DataTable Server-side Processing JS source Code.

jQuery('#saved-members-table').DataTable({
    "processing": true,
    "serverSide": true,
    "ajax": "pakacodes.php?Members=yes", 
     "sScrollX": "100%", 
    aoColumns : [                          
        { "sWidth": "20%" },
        { "sWidth": "20%"},
        { "sWidth": "20%"},
        { "sWidth": "20%"},                           
        { "sWidth": "20%" }
    ],
"fnDrawCallback": function() {
    jQuery('#saved-members-table #live-toggle-example').bootstrapToggle();
}

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Bootstrap Toggle Inside JQuery DataTable.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.