Topic: Ajax

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.

Laravel 5.7 Jquery Ajax CRUD(insert update delete) 0

Laravel 5.7 Jquery Ajax CRUD(insert update delete)

Today, We want to share with you Laravel 5.7 Jquery Ajax CRUD(insert update delete).In this post we will show you Ajax CRUD example in Laravel 5.7 application, hear for Laravel 5.7 CRUD (Create Read Update Delete) Example from scratch we will give you demo and example for implement.In this post, we will learn about Laravel 5.7 CRUD Insert Update Delete using Jquery Ajax Tutorial example with source code with an example.

Laravel 5.7 Jquery Ajax CRUD(insert update delete)

There are the Following The simple About Laravel 5.7 Jquery Ajax CRUD(insert update delete) Full Information With Example and source code.

As I will cover this Post with live Working example to develop Laravel 5.7 CRUD (Create Read Update Delete) Tutorial Example, so the Simple Laravel 5.7 Jquery Ajax CRUD(insert update delete) tutorial example with source code for this example is following below.

Step : 1 Create articles Table Migration

Laravel Table Migration

php artisan make:migration create_Articles_table

After run this commandd open articles table mimgration file and add foollowing code. migration file create automatic in database/migrations/ this location.

database/migrations/

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateArticlesTable extends Migration
{
    public function up()
    {
        Schema::create('articles', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->text('article_content');
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::dropIfExists('articles');
    }
}

And then, Laravel CMD to run following command for run migration.

php artisan migrate

Step : 2 Create articles Table Model

After that, create Article table model usign by following command.

php artisan make:demo Article

And then, open app/Article.php file and past into it following source code.

app/Article.php

namespace App;
use Illuminate\Database\Eloquent\Model;
class Article extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */

    protected $fillable = [
        'title', 'article_content'
    ];
}

Step : 3 Create Laravel Routes

Next, create following routes in routes/web.php file.

routes/web.php

Route::get('web-articles', '[email protected]');
Route::resource('articles','ArticleController');

Step : 4 Make Laravel 5.7 Controller

And then, we need to create ArticleController.php file in app/Http/Controllers/ this path and put into it following source code.

app/Http/Controllers/ArticleController.php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Article;

class ArticleController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function webArticles()
    {
        return view('web-articles');
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $articles = Article::latest()->paginate(5);
        return response()->json($articles);
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $Article = Article::create($request->all());
        return response()->json($Article);
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        $Article = Article::find($id)->update($request->all());
        return response()->json($Article);
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        Article::find($id)->delete();
        return response()->json(['done']);
    }
}

Step : 5 Create Laravel Blade/View File

Now, we will make a web-articles.blade.php file in resources/views/ folder. and then simply put into it following source code. here We are using simple bootstrap layout but you can set accourding to you.

resources/views/web-articles.blade.php

<!DOCTYPE html>
<html>
<head>
  <title>Laravel 5.7 Ajax CRUD Example</title>
  <meta name="csrf-token" content="{{ csrf_token() }}">
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/css/bootstrap.css">
</head>
<body>
  <div class="container">
    <div class="row">
        <div class="col-lg-12 margin-tb">
            <div class="pull-left">
                <h2>Laravel 5.7 Ajax CRUD Example Demo</h2>
            </div>
            <div class="pull-right">
        <button type="button" class="btn btn-success" data-toggle="modal" data-target="#create-data-component">Create New Article</button>
            </div>
        </div>
    </div>
    <table class="table table-bordered">
      <thead>
          <tr>
        <th>Title</th>
        <th>article_content</th>
        <th width="200px">Action</th>
          </tr>
      </thead>
      <tbody>
      </tbody>
    </table>

    <ul id="pagination" class="pagination-sm"></ul>

    <!-- Create data-component Modal -->
    @include('create')
    <!-- Edit data-component Modal -->
    @include('edit')
  </div>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha/js/bootstrap.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twbs-pagination/1.3.1/jquery.twbsPagination.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.5/validator.min.js"></script>
  <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js"></script>
  <link href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css" rel="stylesheet">

  <script type="text/javascript">
    var url = "<?php echo route('articles.index')?>";
  </script>
  <script src="/js/ArticlesAjax.js"></script> 
</body>
</html>

Step : 6 Create JS File

Next, we need to create ArticlesAjax.js JS file in public/js/ path and put into it following source code.

public/js/ArticlesAjax.js

var page = 1;
var active_page = 1;
var total_page = 0;
var ajax_data_call = 0;

manageData();

/* manage data list */
function manageData() {
    $.ajax({
        dataType: 'json',
        url: url,
        data: {page:page}
    }).done(function(data) {
      total_page = data.last_page;
      active_page = data.active_page;
      $('#pagination').twbsPagination({
          totalPages: total_page,
          visiblePages: active_page,
          onPageClick: function (event, pageL) {
            page = pageL;
                if(ajax_data_call != 0){
              fetchAllData();
                }
          }
      });
      handleDatalines(data.data);
        ajax_data_call = 1;
    });
}

$.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
});

/* Get Page Data*/
function fetchAllData() {
  $.ajax({
      dataType: 'json',
      url: url,
      data: {page:page}
  }).done(function(data) {
    handleDatalines(data.data);
  });
}

/* Add new Article table row */
function handleDatalines(data) {
  var data_lines = '';
  $.each( data, function( key, value ) {
      data_lines = data_lines + '<tr>';
      data_lines = data_lines + '<td>'+value.title+'</td>';
      data_lines = data_lines + '<td>'+value.article_content+'</td>';
      data_lines = data_lines + '<td data-id="'+value.id+'">';
        data_lines = data_lines + '<button data-toggle="modal" data-target="#edit-data-component" class="btn btn-primary edit-data-component">Edit</button> ';
        data_lines = data_lines + '<button class="btn btn-danger remove-data-component">Delete</button>';
        data_lines = data_lines + '</td>';
      data_lines = data_lines + '</tr>';
  });
  $("tbody").html(data_lines);
}

/* Create new Article */
$(".crud-submit").click(function(e) {
    e.preventDefault();
    var actions_crud = $("#create-data-component").find("form").attr("action");
    var title = $("#create-data-component").find("input[name='title']").val();
    var article_content = $("#create-data-component").find("textarea[name='article_content']").val();
    $.ajax({
        dataType: 'json',
        type:'Article',
        url: actions_crud,
        data:{title:title, article_content:article_content}
    }).done(function(data){
        fetchAllData();
        $(".modal").modal('hide');
        toastr.success('Article Created Successfully.', 'Success Alert', {timeOut: 5000});
    });
});

/* Remove Article */
$("body").on("click",".remove-data-component",function() {
    var id = $(this).parent("td").data('id');
    var c_obj = $(this).parents("tr");
    $.ajax({
        dataType: 'json',
        type:'delete',
        url: url + '/' + id,
    }).done(function(data) {
        c_obj.remove();
        toastr.success('Article Deleted Successfully.', 'Success Alert', {timeOut: 5000});
        fetchAllData();
    });
});

/* Edit Article */
$("body").on("click",".edit-data-component",function() {
    var id = $(this).parent("td").data('id');
    var title = $(this).parent("td").prev("td").prev("td").text();
    var article_content = $(this).parent("td").prev("td").text();
    $("#edit-data-component").find("input[name='title']").val(title);
    $("#edit-data-component").find("textarea[name='article_content']").val(article_content);
    $("#edit-data-component").find("form").attr("action",url + '/' + id);
});

/* Updated new Article */
$(".crud-submit-edit").click(function(e) {
    e.preventDefault();
    var actions_crud = $("#edit-data-component").find("form").attr("action");
    var title = $("#edit-data-component").find("input[name='title']").val();
    var article_content = $("#edit-data-component").find("textarea[name='article_content']").val();
    $.ajax({
        dataType: 'json',
        type:'PUT',
        url: actions_crud,
        data:{title:title, article_content:article_content}
    }).done(function(data){
        fetchAllData();
        $(".modal").modal('hide');
        toastr.success('Article Updated Successfully.', 'Success Alert', {timeOut: 5000});
    });
}); 

Last I am ready to Laravel Project run our example Therefor run bellow command ro quick run:

Laravel 5.7 run our example

php artisan serve

Finnally Step We can open bellow simple URL on your Browsers run:

http://localhost:8000/web-articles

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 Laravel 5.7 Jquery Ajax CRUD(insert update delete).
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.

laravel ajax csrf tokens Example jQuery Ajax Call 0

laravel ajax csrf tokens Example - jQuery Ajax Call

Today, We want to share with you laravel ajax csrf tokens Example.In this post we will show you csrf token laravel form, hear for Laravel 5 csrf tokens in ajax calls we will give you demo and example for implement.In this post, we will learn about CSRF Protection with Ajax and Laravel with an example.

laravel ajax csrf tokens Example

There are the Following The simple About laravel ajax csrf tokens Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop get csrf token in controller laravel, so the some major files and Directory structures for this example is following below.Laravel 5 csrf tokens in ajax calls

Pass the token in your Ajax headers

laravel ajax csrf, CSRF stands for simple meanning “cross site request forgery” as well as is a type of more some attack where as like a malicious website or any email, some instant message, as well as some program causes a web browser like a mozila, chrome to perform an unwanted some events action on a more website for which the get user is currently users authenticated.

$.ajaxSetup({ headers: { 'csrftoken' : '{{ csrf_token() }}' } });

In Laravel 5 version or any more Like Laravel 5.4, Laravel 5.5, Laravel 5.6, or Laravel 5.7, all laravel csrf token ajax requests must pass through server request the Middleware which will not allow any some json or any object POST requests without the correct(CSRF Protection) CSRF token.

CSRF (Cross Site Request Forgery)

Now, csrf token laravel ajax simple prevents the web site fetching requests from browser side means clients that it has not any types of the established a data connection with. IE a simple defination of the random post request from a any third party.

Example 1: laravel ajax post csrf

$.ajax({
  type: "POST",
  url: "/userinfoStatus",
  data: {   lastname: datalastname,
			firstresults: getfirstresults,
			bearing: 90,
			'_token': '{!! csrf_token() !!}'
		}
})

Example 2: laravel csrf token ajax

   
      <title>csrf token laravel ajax - Ajax Example</title>
      
      
      
      
      
         function getMessage() {
            $.ajax({
               type:'POST',
               url:'/userinfoStatus',
               data:'_token = ',
               success:function(data) {
                  $("#results").html(data.results);
               }
            });
         }
      
   
   
   
      <div id='results'>This message(laravel csrf token ajax) will be replaced using Ajax. 
         Click the button to Append the message.</div>
      'getMessage()']);
      ?>
   


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 laravel ajax csrf tokens 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.

jQuery delay Effects with Animation Example 0

jQuery delay Effects with Animation Example

Today, We want to share with you jQuery delay Effects with Animation Example.In this post we will show you jQuery delay Animation Effects, hear for Delay jQuery animation by few seconds we will give you demo and example for implement.In this post, we will learn about Different time delay in image effects jquery with an example.

jQuery delay Effects with Animation Example

There are the Following The simple About jQuery delay Effects with Animation Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop Apply multiple animation effects, so the jQuery setTimeout: 2 demos including JavaScript/jQuery this example is following below.

jQuery delay Animation Effects

jQuery delay() Syntax:

$(selector).delay (speed, queueName)   

Full Example of the : Apply multiple animation effects

<!DOCTYPE html>
<html>
<head>
    <title>Delay jQuery animation by few seconds - Examples</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("#card1").delay("slow").fadeIn();
    $("#card2").delay("fast").fadeIn();
    $("#card3").delay(800).fadeIn();
    $("#card4").delay(2500).fadeIn();
    $("#card5").delay(5000).fadeIn();
  });
});
</script>
</head>
<body>

<p>This example Delay jQuery animation by few seconds.</p>
<button>Click to Apply multiple animation effects</button>
<br><br>

<div id="card1" style="width:85px;height:85px;display:none;background-color:black;"></div><br>
<div id="card2" style="width:85px;height:85px;display:none;background-color:green;"></div><br>
<div id="card3" style="width:85px;height:85px;display:none;background-color:blue;"></div><br>
<div id="card4" style="width:85px;height:85px;display:none;background-color:red;"></div><br>
<div id="card5" style="width:85px;height:85px;display:none;background-color:purple;"></div><br>

</body>
</html>

How to wait 5 seconds with jQuery

Simple Call a Function After Some Time in jQuery

setTimeout(
  function() 
  {
    alert("");
  }, 5000);

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 delay Effects with Animation 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.

Laravel 5.7 Toggle switch Update DB field using Ajax 0

Laravel 5.7 Toggle switch Update DB field using Ajax

Today, We want to share with you Laravel 5.7 Toggle switch Update DB field using Ajax.In this post we will show you Bootstrap Toggle Switch Inside Laravel Examples, hear for Use Ajax Checkbox Toggles To Update The Database we will give you demo and example for implement.In this post, we will learn about Bootstrap Toggle switch Update DB field using Ajax with Laravel 5.7 with an example.

Laravel 5.7 Toggle switch Update DB field using Ajax

There are the Following The simple About Laravel 5.7 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 php Laravel toggle switch with ajax update, so the Simple Laravel Toggle Switch Plugin With jQuery And Bootstrap for this example is following below.Demo – Laravel 5.7 toggle switch

Step 1: Laravel Create a Controller

Laravel – Toggle value in database with checkbox and ajax Example

public function updateProductStatus(Request $request)
{

    $member = User::findOrFail($request->member_id);
    if($member->active == 1){
        $member->active = 0;
    } else {
        $member->active = 1;
    }
    return response()->json([
      'data' => [
        'success' => $member->save(),
      ]
    ]);
}

Step 2: JavaScript Source Code

$(document).ready(function(){
  $("input:checkbox").change(function() {
    var member_id = $(this).closest('tr').attr('id');

    $.ajax({
            type:'POST',
            url:'/updateProductStatus',
            headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}' },
            data: { "member_id" : member_id },
            success: function(data){
              if(data.data.success){
                //do something logic
              }
            }
        });
    });
});    

Related Keywords: laravel toggle button, Laravel 5.7 toggle switch, Laravel 5.7 toggle switch with text, Laravel 5.7 toggle switch, html toggle button, ajax toggle button php, Laravel 5.7 switch options, Laravel 5.7 toggle set value

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 Laravel 5.7 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.

Ajax Image Upload without Refreshing Page using Jquery 0

Ajax Image Upload without Refreshing Page using Jquery

Today, We want to share with you Ajax Image Upload without Refreshing Page using Jquery.In this post we will show you Upload an image without refreshing page in php, hear for PHP Image upload without refreshing page using jquery example we will give you demo and example for implement.In this post, we will learn about Image Upload Without Refreshing Page Using JQUERY, PHP & MYSQLi with an example.

Ajax Image Upload without Refreshing Page using Jquery

There are the Following The simple About Ajax Image Upload without Refreshing Page using Jquery Full Information With Example and source code.

As I will cover this Post with live Working example to develop Image Upload without Page Refresh with PHP and jQuery with Demo, so the PHP Image upload without refreshing page using jquery example is following below.

php image upload no refresh script

index.php

In this example Full source code for Image Upload Without Refreshing Page Using JQUERY, PHP & MYSQLi

<html lang="en">
<head>
<title>PHP - Image Uploading with Form JavaScript Example - pakainfo.com</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" >

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script> 
<script src="http://malsup.github.com/jquery.form.js"></script> 
<script> 
        $(document).ready(function() { 
            $(".upload-image").click(function(){
            	$(".form-horizontal").ajaxForm({target: '.img_previews'}).submit();
            });
        }); 
</script>
</head>
<body>
	<nav class="pakainfo navbar navbar-default">
		<div class="pakainfo container-fluid">
		<div class="pakainfo navbar-header">
		<a class="pakainfo navbar-brand" href="#">Free Source code For PHP - Image Uploading with Form JavaScript Example</a>
		</div>
		</div>
	</nav>
	<div class="pakainfo container">
	<form action="imageuploadpro.php" enctype="multipart/form-data" class="form-horizontal" method="post">
		<div class="img_previews"></div>
		<input type="file" name="image" class="pakainfo form-control" style="width:50%" />
		<button class="btn btn-success upload-image">Upload</button>
	</form>
	</div>
</body>
</html>

And then, now make a simple another PHP file for fetch php post http request as well as files or image uploading source code, Therefor make a PHP imageuploadpro.php file and put the simple bellow source code:

imageuploadpro.php

here server side Source Code for image upload without refreshing page using jquery Example

<?php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root(username)');
define('DB_PASSWORD', 'My_password');
define('DB_DATABASE', 'pakainfo_database');
$db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);

if(isset($_POST) && !empty($_FILES['image']['name'])){
	
	$name = $_FILES['image']['name'];
	list($txt, $ext) = explode(".", $name);
	$uploaded_img_name = time().".".$ext;
	$tmp = $_FILES['image']['tmp_name'];


	if(move_uploaded_file($tmp, 'upload/'.$uploaded_img_name)){
		mysqli_query($db,"INSERT INTO items (title)
		VALUES ('".$uploaded_img_name."')");
		echo "<img width='300px' src='upload/".$uploaded_img_name."' class='img_previews'>";
	}else{
		echo "Sorry !!, Your images uploading failed";
	}

}
?>

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 Ajax Image Upload without Refreshing Page using Jquery.
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.

JavaScript isNaN Function Example with demo 0

JavaScript isNaN Function

Today, We want to share with you JavaScript isNaN Function Example.In this post we will show you Check if variable is a number in JavaScript, hear for isNaN function to check a number if string or not in JavaScript we will give you demo and example for implement.In this post, we will learn about Javascript Numbers, NaN, isNaN, parseInt, parsefloat function with an example.

JavaScript isNaN Function Example

There are the Following The simple About JavaScript isNaN Function Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop Data Type Conversion and IsNaN() Function in JavaScript, so the how to convert nan to number in javascript for this example is following below.

Simple Small JavaScript methods or function to check if a javascript variable is a number check.

function check_live_Value(data_value){
  if(isNaN(data_value)){
	return false;
  }else{
	return true;
  }
}

Example : JavaScript Number isNaN() Method

<!DOCTYPE html>
<html>
<body>
<p>JavaScript Number isNaN() Method.</p>
<button onclick="myFunction()">Click It</button>
<p id="demo"></p>

<p><strong>Note:</strong> The Number.isNaN() function is not supported in IE 11 (and earlier versions).</p>

<script>
function myFunction() {
  var data_results = "";
  data_results = data_results + Number.isNaN(123) + ": 123<hr>";
  data_results = data_results + Number.isNaN(-1.23) + ": -1.23<hr>";
  data_results = data_results + Number.isNaN(5-2) + ": 5-2<hr>";
  data_results = data_results + Number.isNaN(0) + ": 0<hr>";
  data_results = data_results + Number.isNaN('123') + ": '123'<hr>";
  data_results = data_results + Number.isNaN('Hello') + ": 'Hello'<hr>";
  data_results = data_results + Number.isNaN('2005/12/12') + ": '2005/12/12'<hr>";
  data_results = data_results + Number.isNaN('') + ": ''<hr>";
  data_results = data_results + Number.isNaN(true) + ": true<hr>";
  data_results = data_results + Number.isNaN(undefined) + ": undefined<hr>";
  data_results = data_results + Number.isNaN('NaN') + ": 'NaN'<hr>";
  data_results = data_results + Number.isNaN(NaN) + ": NaN<hr>";
  data_results = data_results + Number.isNaN(0 / 0) + ": 0 / 0<hr>";

  document.getElementById("demo").innerHTML = data_results;
}
</script>

</body>
</html>

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 JavaScript isNaN Function 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.

Jquery Fancybox Popup Simple Example 0

Jquery Fancybox Popup Simple Example

Today, We want to share with you Jquery Fancybox Popup Simple Example.In this post we will show you Magnific Popup – Responsive jQuery Lightbox Plugin, hear for responsive lightbox image gallery jquery we will give you demo and example for implement.In this post, we will learn about jquery thumbnail gallery with lightbox free download with an example.

Jquery Fancybox Popup Simple Example

There are the Following The simple About Jquery Fancybox Popup Simple Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop Responsive jQuery Lightbox With Amazing CSS3 Effects, so the jquery fancybox example cdn for this example is following below.

Simple jQuery Fancybox Popup Box

Here simple fancyBox is a main plugin that A collection of the Example created in data response to questions and answer a good and Best way to add/put zooming functionality for More images, Simple html Data content as well as some multi-media on your HTML webpages.and include the jquery fancybox cdn

index.html

<!DOCTYPE html>
<html>
<head>
  <title>Fancybox Simple Example - pakainfo.com</title>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.css" media="screen">
  <script src="//cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.js"></script>
</head>
<body>
<h1>Fancybox All Profile List</h1>
<a class="fancybox" rel="ligthbox" href="http://placehold.it/300x320.png">
    <img class="img-responsive pakainfo" width="100px" alt="pakainfo" src="http://placehold.it/320x320" />
</a>
<a class="fancybox" rel="ligthbox" href="http://placehold.it/300x320.png">
    <img class="img-responsive pakainfo" width="100px" alt="pakainfo" src="http://placehold.it/320x320" />
</a>
<a class="fancybox" rel="ligthbox" href="http://placehold.it/300x320.png">
    <img class="img-responsive pakainfo" width="100px" alt="pakainfo" src="http://placehold.it/320x320" />
</a>
<script type="text/javascript">
//Setting of the jQuery Simple Fancybox using jQuery
  $(".fancybox").fancybox({
      openEffect: "none",
      closeEffect: "none"
  });
</script>
</body>
</html>

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 Fancybox Popup Simple 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.

Vue JS Datepicker Examples with Demo 0

Vue JS Datepicker Examples with Demo

Today, We want to share with you Vue JS Datepicker Examples with Demo.In this post we will show you Bootstrap Examples vuejs datepicker, hear for vue JS enabling/disabling datepicker we will give you demo and example for implement.In this post, we will learn about VueJS Datepicker for Bootstrap and Material Design with an example.

Vue JS Datepicker Examples with Demo

There are the Following The simple About Vue JS Datepicker Examples with Demo Full Information With Example and source code.

As I will cover this Post with live Working example to develop Vue JS Datepicker Widget, so the Vue DatePicker Component for this example is following below.

Step 1: HTML Part

index.html

<script src="https://unpkg.com/flatpickr"></script>
<h3>VueJS Datepicker Examples - Pakainfo.com</h3>
<div id="live_datepicker">
  <div class="ui form">
    <datepicker v-model="date"></datepicker>
  </div>
</div>

<template id="datepicker">
  <div ref="date" class="ui left action input">
    <button class="ui icon button" data-toggle>
      <i class="calendar icon"></i>
    </button>
    <input type="text" :name="name" :placeholder="placeholder" :readonly="readonly" @change="$emit('input', $event.target.value)" data-input/>
    <button class="ui inverted icon button" :disabled="!value" data-clear>
      <i class="remove red icon"></i>
    </button>
  </div>
</template>

Step 2: Include CDN(vuejs datepicker cdn)

Include Vuejs and datepicker CSS and Scripts libs Like vuejs datepicker style, vuejs datepicker cdn.

<script src="https://unpkg.com/flatpickr"></script>
@import url('https://unpkg.com/[email protected]/semantic.css');
@import url('https://unpkg.com/flatpickr/dist/flatpickr.min.css');

Step 3: Add a JavaScript Source Code

Include Vuejs and datepicker CSS and Scripts source code

Vue.component('datepicker', {
	name: 'datepicker',
  template: '#datepicker', //vuejs template
  props: {
    name: String,
    value: {
      require: true
    },
    placeholder: String,
    readonly: Boolean
  },
  //current date get
  date() {
    return {
      datepicker: null
    }
  },
  mounted() {
    if (!this.datepicker) {
      this.datepicker = flatpickr('.ui.input', {
        wrap: true
      })
    }
  },
  destroyed() {
    this.datepicker.destroy()
    this.datepicker = null
  }
})

new Vue({
	el: '#live_datepicker',
  data() {
  	return {
    	date: null
    }
  },
  watch: {
  	date() {
    	console.log(this.date)
    }
  }
})

Simple UI VueJS DatePicker Demo
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 Datepicker Examples 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.

jQuery change class Examples with Demo 0

jQuery change class Examples with Demo

Today, We want to share with you jquery change class Examples with Demo.In this post we will show you jQuery: Change a CSS class using jQuery, hear for Add and remove a class to an anchor tag with jQuery we will give you demo and example for implement.In this post, we will learn about jQuery toggleClass to Switch Between Classes with an example.

jquery change class Examples with Demo

There are the Following The simple About jquery change class Examples with Demo Full Information With Example and source code.

As I will cover this Post with live Working example to develop jquery detect class change event – jQuery, so the jQuery Get Attribute, Set Attribute, Remove Attribute for this example is following below.

jQuery Get and Set CSS Classes

<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js">
</script>

jQuery has simple addClass(), removeClass() as well as toggleClass() methods to change class using jQuery as Examples below.

//Jquery Add a class
$('#preiview_msg').addClass('class_name');

//Jquery Remove a class
$('#preiview_msg').removeClass('class_name');

//Jquery Remove old class and add new class
$('#preiview_msg').removeClass('my_old_class_name').addClass('my_live_class_name');

//Or a short way to swap classes in Jquery
$("#preiview_msg").toggleClass('my_old_class_name my_live_class_name');

//Set the Jquery class regardless of what it was
$("#preiview_msg").attr('class', 'my_live_class_name');

Therefor after putting jQuery script(jQuery Change CSS Dynamically) We can use these 2 main jquery methods in desired jQuery event to change class using jQuery like below examples.

jquery change class of element

<script type="text/javascript">
$(document).ready(function(){  
    $('#display_message').removeClass('purple').addClass('black');
});
</script>

simple jquery change class Events

<script type="text/javascript">
$("button").click(function () {
    $('#display_message').attr('class', 'loading...');
});
</script>

Angular 6 CRUD Operations Application Tutorials

Read :

Related Keywords :jquery CSS change class name, javascript change class, Change Class using Jquery, jQuery Get and Set CSS Classes, jQuery Change CSS Dynamically, jquery change class attribute, jquery remove all classes

Summary

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

I hope you get an idea about jquery change class Examples 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.