Topic: jQuery

jquery radio button selected event 0

jquery radio button selected event

Today, We want to share with you jquery radio button selected event.In this post we will show you Jquery If radio button is checked, hear for jquery set radio button checked based on value we will give you demo and example for implement.In this post, we will learn about How to get selected radio button value in Jquery? with an example.

jquery radio button selected event

There are the Following The simple About jquery radio button selected event Full Information With Example and source code.

As I will cover this Post with live Working example to develop javascript radio button value if checked, so the jquery set radio button checked based on value for this example is following below.

Example 1:

index.html

<!DOCTYPE html>
<html>
<head>
    <title>How to get selected radio button value in Jquery? - pakainfo.com</title>
    <script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
</head>
<body>
   
<input type="radio" name="gender" class="gender" value="male"> Male
<input type="radio" name="gender" class="gender" value="female"> Female
<button>Click to redirect</button>
   
<script type="text/javascript">
   
    $("button").click(function(){
        var fetchVal = $("input[type='radio']:checked").val();
        console.log(fetchVal);
    });
   
</script>
  
</body>
</html>

Web Programming Tutorials Example with Demo

Read :

Summary

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

I hope you get an idea about jquery radio button selected event.
I would like to have feedback on my infinityknow.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.

Laravel Autocomplete Textbox with Multiple values using jQuery and MySQL 0

Laravel Autocomplete Textbox with Multiple values using jQuery and MySQL

Laravel Autocomplete Textbox with Multiple values using jQuery and MySQL

In this Post We Will Explain About is Laravel Autocomplete Textbox with Multiple values using jQuery and MySQL With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Laravel – Input multiple tags with dynamic autocomplete Example

In this post we will show you Best way to implement Laravel – Autocomplete Multiple Fields, hear for Laravel 5 – Simple Autocomplete Multiple values Using jQuery, Ajax and MySQL with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Step 1: Make Sample Table

In first Phase, We will create some sample table Like as a “students” to test this spource code.

CREATE TABLE `students` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `stud_sname` varchar(3) NOT NULL,
 `name` varchar(150) NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=247 DEFAULT CHARSET=utf8

Step 2: Add routes

In this Simple Phase, We will add the simple following two Laravel routes :

Route::get('autocomplete', 'studentN[email protected]');

Route::get('searchajax', ['as'=>'searchajax','uses'=>'[email protected]']);

Step 3: Create Controller

In this Phase, We will Make studentNameListController.php in following path Laravel web-application like as a app/Http/Controllers.

app/Http/Controllers/studentNameListController.php

get('term','');
        $students=\DB::table('students');
        if($request->type=='studentname'){
            $students->where('name','LIKE','%'.$query.'%');
        }
        if($request->type=='student_code'){
            $students->where('stud_sname','LIKE','%'.$query.'%');
        }
           $students=$students->get();        
        $data=array();
        foreach ($students as $student) {
                $data[]=array('name'=>$student->name,'stud_sname'=>$student->stud_sname);
        }
        if(count($data))
             return $data;
        else
            return ['name'=>'','stud_sname'=>''];
    }
}

Step 4: Create View File

Last Phase We will make a simple file like as a autocomplete.blade.php in following path Laravel web-application resources/views/.



    <title>Laravel Autocomplete Textbox with Mutiple values using jQuery and MySQL</title>
    
  
    
  


<!-- Devloped by Pakainfo.com free download examples -->
<div class="container">
  <h1>Laravel Autocomplete Textbox with Mutiple values using jQuery and MySQL</h1>
  {!! Form::open() !!}
<!-- Devloped by Pakainfo.com free download examples -->      
    <table class="table table-bordered">
      <tr>
          <th></th>
          <th>S. No</th>
          <th>Student Name</th>
          <th>Student code</th>
      </tr>
      <tr>
          <td></td>
          <td><span id='sn'>1.</span></td>
          <td></td>
          <td> </td>
        </tr>
      </table>
      <button type="button" class='btn btn-danger delete'>- Delete</button>
      <button type="button" class='btn btn-success addbtn'>+ Add More</button>
  {!! Form::close() !!}
</div>

          
 $(".delete").on('click', function() {
  $('.chkbox:checkbox:checked').parents("tr").remove();
  $('.check_all').prop("checked", false); 
  studentUpdateId();
});
var i=$('table tr').length;
$(".addbtn").on('click',function(){
  count=$('table tr').length;
  
    var data="<tr><td></td>";
      data+="<td><span id='sn"+i+"'>"+count+".</span></td>";
      data+="<td></td>";
      data+="<td></td></tr>";
  $('table').append(data);
  i++;
});
        
function all_student() {
  $('input[class=chkbox]:checkbox').each(function(){ 
    if($('input[class=check_all]:checkbox:checked').length == 0){ 
      $(this).prop("checked", false); 
    } else {
      $(this).prop("checked", true); 
    } 
  });
}
function studentUpdateId(){
  obj=$('table tr').find('span');
  $.each( obj, function( key, value ) {
    id=value.id;
    $('#'+id).html(key+1);
  });
}
//Live autocomplete script
$(document).on('focus','.liveAuto_txt',function(){
  type = $(this).data('type');
  
  if(type =='studentname' )autoType='name'; 
  if(type =='student_code' )autoType='stud_sname'; 
  
   $(this).autocomplete({
       minLength: 0,
       source: function( request, response ) {
            $.ajax({
                url: "{{ route('searchajax') }}",
                dataType: "json",
                data: {
                    term : request.term,
                    type : type,
                },
                success: function(data) {
                    var array = $.map(data, function (stud) {
                       return {
                           label: stud[autoType],
                           value: stud[autoType],
                           data : stud
                       }
                   });
                    response(array)
                }
            });
       },
       select: function( event, ui ) {
           var data = ui.stud.data;           
           id_arr = $(this).attr('id');
           id = id_arr.split("_");
           paramId = id[id.length-1];
           $('#studentname_'+paramId).val(data.name);
           $('#student_code_'+paramId).val(data.stud_sname);
       }
   });
   
   
});

<!-- Devloped by Pakainfo.com free download examples -->


You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is Laravel autocomplete multiple fields with single auto-select request And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

jQuery Multidimensional Array name selector 0

jQuery Multidimensional Array name selector

Today, We want to share with you jQuery Multidimensional Array name selector.In this post we will show you Jquery, get value of multidimentional array key, hear for Select multidimensional arrays from form with jquery we will give you demo and example for implement.In this post, we will learn about jQuery selector name attribute multidimensional array with an example.

jQuery Multidimensional Array name selector

There are the Following The simple About jQuery Multidimensional Array name selector Full Information With Example and source code.

As I will cover this Post with live Working example to develop jQuery: Calculate multidimensional array by keyname, so the some major files and Directory structures for this example is following below.

Example 1: Create a multi dimensional array from form fields

        $('input[name="products[qty][price]"]')

Example 2: jQuery | Input name with multiple dimensional array

        $('select[name="categories[1][name]"]');

Example 3: jQuery multi-dimensional array name selector

        $(':input[name="categories[1][name]"]');

Multidimensional Array name selector

HTML Part

        

jQuery Part

        $(this).parents(".product-dtl").find("input[name='products[title][]']").remove();
        $("input[name='products[title][]']").on('change', function(){
          alert("in function");
        });

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 Multidimensional Array name selector.
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.

PHP CodeIgniter 3 Validation Example Tutorial From Scratch 0

PHP CodeIgniter 3 Validation Example Tutorial From Scratch

Today, We want to share with you PHP CodeIgniter 3 Validation Example Tutorial From Scratch.In this post we will show you CodeIgniter and Ajax using jQuery, hear for Php CodeIgniter Server Side Form Validation Example we will give you demo and example for implement.In this post, we will learn about Ajax contact us form validation in Codeigniter 3 using javascript jQuery with an example.

PHP CodeIgniter 3 Validation Example Tutorial From Scratch

There are the Following The simple About PHP CodeIgniter 3 Validation Example Tutorial From Scratch Full Information With Example and source code.

As I will cover this Post with live Working example to develop PHP jQuery Ajax CodeIgniter Form Validation, so the some major files and Directory structures for this example is following below.

  • PHP jQuery Ajax CodeIgniter Form Validation
  • FormCiValidate.php
  • ajax_form_validate.php

Step 1: Include Codeigniter 3 Routes

Include routes to handle ajax request

<?php
defined('BASEPATH') OR exit('No direct script access allowed');


$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

$route['simple-ajax-frm-validate'] = "FormCiValidate";
$route['simple-ajax-frm-validate/post']['post'] = "FormCiValidate/validateForm";

Step 2: Make FormCiValidate simple Controller Class

application/controllers/FormCiValidate.php

load->library('form_validation');
      $this->load->library('session');
   }

   public function index()
   {
      $this->load->view('ajax_form_validate');
   }

   public function validateForm()
   {
        $this->form_validation->set_rules('name', 'Name', 'required');
        $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
        $this->form_validation->set_rules('comments', 'Comment', 'required');


        if ($this->form_validation->run() == FALSE){
            $errors = validation_errors();
            echo json_encode(['error'=>$errors]);
        }else{
           echo json_encode(['success'=>'Form submitted successfully.']);
        }
    }
}

Step3: Make HTML Interface View File

ajax_form_validate.php

   
    <title>CodeIgniter 3 Form Submission Using jQuery - pakainfo.com</title>
     
    
  
   
  <div class="pakainfo container">
    <div class="row">
      <div class="col-sm-8 col-sm-offset-2">
        <div class="alert alert-info">
        </div>
		<h1>PHP jQuery Ajax CodeIgniter Form Validation</h1>
       
        <div class="gst form-group pakainfo">
          <label>Name:</label>
          
        </div>

        <div class="gst form-group pakainfo">
          <strong>Email:</strong>
          
        </div>

        <div class="gst form-group pakainfo">
          <strong>Comment:</strong>
          <textarea class="lst form-control" name="comments"></textarea>
        </div>

        <div class="gst form-group pakainfo">
          <button class="btn btn-success btn-block frm-submit">Submit</button>
        </div>
      </form>
    </div>
    </div>
  </div>
   


   
    $(document).ready(function() {
      $(".frm-submit").click(function(e){
        e.preventDefault();
        var name = $("input[name='name']").val();
        var email = $("input[name='email']").val();
        var comments = $("textarea[name='comments']").val();

        console.log($(this).closest('form').attr('action'));
          $.ajax({
              url: $(this).closest('form').attr('action'),
              type:$(this).closest('form').attr('method'),
              dataType: "json",
              data: {name:name, email:email, comments:comments},
              success: function(data) {
                  if($.isEmptyObject(data.error)){
                    $(".alert-info").css('display','none');
                    alert(data.success);
                  }else{
                    $(".alert-info").css('display','block');
                    $(".alert-info").html(data.error);
                  }
              }
          });


      }); 


  });

   

Angular 6 CRUD Operations Application Tutorials

Read :

Related Search: PHP jQuery Ajax CodeIgniter Form Validation, Ajax contact us form validation in Codeigniter 3 using javascript jQuery,form validation in codeigniter using jquery,simple contact us form validation using jquery in codeigniter 3 with example

Summary

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

I hope you get an idea about PHP CodeIgniter 3 Validation Example Tutorial From Scratch.
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.

PHP Laravel Datatable Server Side Processing using jQuery 0

PHP Laravel Datatable Server Side Processing using jQuery Ajax

Today, We want to share with you PHP Laravel Datatable Server Side Processing using jQuery Ajax.In this post we will show you Datatables Server Side Processing in Laravel 5.7, hear for datatables Laravel server-side processing in codeigniter using ajax we will give you demo and example for implement.In this post, we will learn about jQuery Datatable Server Side Processing With Custom Operations using Laravel with an example.

PHP Laravel Datatable Server Side Processing using jQuery Ajax

There are the Following The simple About PHP Laravel Datatable Server Side Processing using jQuery Ajax Full Information With Example and source code.

As I will cover this Post with live Working example to develop Laravel server side processing for Datatables, so the laravel 5.7 datatables package for this example is following below.

Step 1: include Datatables CSS file and Javascript files from CDN

        

Step 2: HTML table in Laravel Blade File

Here are the steps to be followed for Implement datatables server side processing Laravel

Let the Laravel blade view page be datatable.blade.php. Your HTML Data table columns may be all the different but the step by step (laravel datatables tutorial) here.

<h3>List of The All Articles Title</h3>
<table class="table table-bordered" id="article_datatables">
    <thead>
           <th>Id</th>
           <th>Title</th>
           <th>Action</th>
          
    </thead>                
</table>

Step 3: javascript Source code

And then call simple Laravel Ajax using javascript source code given below. This ajax will automatically call action when you load your page.Below we can ajax request source code. Put this laravel datatables ajax source code to your Laravel blade view page of laravel at the bottom with laravel datatables pagination.

    $(document).ready(function () {
        $('#article_datatables').DataTable({
            "processing": true,
            "serverSide": true,
            "ajax":{
                     "url": "/fetch_all_articles’",
                     "dataType": "json",
                     "type": "POST",
                     "data":{ _token: "{{csrf_token()}}"}
                   },
            "columns": [
                { "data": "id" },
                { "data": "title" },
                { "data": "action" }
            ]    

        });
    });

Step 4: Laravel Define Route

Put Laravel Route in your web.php files

And then we want set Laravel route for this method, so we have to go to routes/web.php file and write following source code for set route for index method.

Route::post(‘/fetch_all_articles’,’[email protected])

Step 5: Source code for fetchAllArticles function in ArticleController

jQuery Live Server side Datatable for pagination, records and search filters in laravel datatable server side.

 public function fetchAllArticles(Request $request)
    {

        $columns = array(
            0 => 'id',
            1 => 'title',
        );
        $totalTitles = Article::where('deleted_at', '=', null)
            ->count();
        $totalFiltered = $totalTitles;

        $limit = $request->input('length');
        $start = $request->input('start');
        $order = $columns[$request->input('order.0.column')];
        $page_dir = $request->input('order.0.dir');

        if (empty($request->input('search.value'))) {
            $titles = Article::where('deleted_at', '=', null)
                ->offset($start)
                ->limit($limit)
                ->orderBy($order, $page_dir)
                ->get();
        } else {
            $string_search = $request->input('search.value');

            $titles = Article::where('title', 'LIKE', "%{$string_search}%")
                ->where('deleted_at', '=', null)
                ->offset($start)
                ->limit($limit)
                ->orderBy($order, $page_dir)
                ->get();

            $totalFiltered = Article::where('title', 'LIKE', "%{$string_search}%")
                ->where('deleted_at', '=', null)
                ->count();
        }

        $all_products_data = array();
        if (!empty($titles)) {
            $count = 1;
            foreach ($titles as $title) {

                $nestedData['id'] = $count;
                $nestedData['title'] = $titles->title;
                $nestedData['action'] = '<button type="button" class="btn btn-success" title="Edit">
                                        </button>
                                        <button type="button" style="margin-left:6px" class="btn btn-success" title="Article Delete">
                                        </button>';
                $all_products_data[] = $nestedData;
                $count++;
            }
        }

        $product_data = array(
            "draw" => intval($request->input('draw')),
            "recordsTotal" => intval($totalTitles),
            "recordsFiltered" => intval($totalFiltered),
            "data" => $all_products_data,
        );
        echo json_encode($product_data);
 }

Code Understanding

$request – In this case by default all datatables parameters are gets that are sent by jquery ajax serever side datatable.

$totalTitles – totalTitles are the sum all thr count that will be used for Ajax call jquery Datatables pagination in your Laravel Serverside datatable.

$limit – page data record limit is the set variable that init mode number of data records to be get at a time. ( No of total data records to display on page one )

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 Laravel Datatable Server Side Processing using jQuery 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.