Category : Javascript



Jquery ajax request example

If you are very fresher in jquery and you don't know how to work post ajax request then bellow example can help you. i gave you the example of POST ajax request with json, you can also easily modify this example. you also fire GET ajax request using this example. bellow example is a pretty simple to undestand how to work $.ajax method. so let's see bellow example and try to undestand. <strong class="example">Example:</strong> <pre class="prettyprint lang-php"> <html lang="en"> <head> <title>JQuery Ajax Demo</title> <script src="http://cdnjs.cloudflare.com/ajax/lib.....

By Hardik Savani | April 10, 2016 | | 3308 Viewer | Category : Javascript
READ MORE

How to parse json in jquery ajax?

When you are working php or .net etc and you return data like json_encode($data) on ajax request. but in front side you get like a string at that time you have to parse json object and get them. so, let's see example and learn how to use: <strong class="example">Example</strong> <pre class="prettyprint lang-php"> var request = $.ajax({ type: 'POST', dataType: 'json', url: 'http://www.mysite.com/getpostuser', data: {token:obj['token'],postid: obj['postid']} }); request.done(function(msg) { msg = JSON.parse(msg); msg.forEach(function(items) { var e = "notify-"+items.userid; .....

By Hardik Savani | April 5, 2016 | | 3048 Viewer | Category : Javascript
READ MORE

How to create scroll to top of the page by jquery animate ?

However you want the scrolling process to have animated effect. you have to follow bellow example. in this post you can add button for scrolling top with animate effect. Most of website you can see with one button left side or right side for scrolling top of the page. so, if you want to create on your site then you have to add following jquery code: <strong class="example">Example</strong> <pre class="prettyprint lang-html lang-js"> <style type="text/css"> #toTopImg{ position: fixed; bottom: 20px; left: 20px; cursor: pointer; display: none; z-index.....

By Hardik Savani | March 26, 2016 | | 2285 Viewer | Category : Javascript
READ MORE

How to remove particular value from jquery array?

When i was working on my code PHP project, at that time i need to remove specific items value from my javascript array. i did google search and solve that but i would like to share in my site how to remove value from javascript array. so, let's see how to use: <strong class="example">Example:</strong> <pre class="prettyprint lang-js"> var languages = ['php', 'laravel', '.net', 'java', 'c#', 'javascript'] var deleteLanguage = 'laravel'; languages = jQuery.grep(languages, function(value) { return value != deleteLanguage; }); console.log(languages); </pre>

By Hardik Savani | March 23, 2016 | | 992 Viewer | Category : Javascript
READ MORE

How to remove undefined value from jquery array?

If you have jquery or javascript array with lots of undefined value and you want to remove all undefined value from array. you can remove undefined items from your array without using each loop you have to just use filter, I would like give the example how to remove undefined element from javascript array. so, let's see bellow example. <strong class="example"></strong> <pre class="prettyprint lang-javascript lang-html"> <script type="text/javascript"> var obj = ['3','3','5',undefined,'hi']; obj = obj.filter(function(e){return e}); console.log(obj); </script> </pre>

By Hardik Savani | March 12, 2016 | | 2106 Viewer | Category : Javascript
READ MORE

How to redirect page using JQuery?

You can redirect page or url in your js file. when you require to redirect page form jquery thrn you can use window.location.href. window.location.href through you can redirect url using jquery/javascript. So, Let's see following example: <strong>Example:</strong> <pre class="prettyprint lang-js">window.location.href = "http://itsolutionstuff.com";</pre>

By Hardik Savani | March 10, 2016 | | 2083 Viewer | Category : Javascript
READ MORE

Multi select autocomplete jquery example with code

In this post i show you how to use autocomplete with multiple select option by jquery. I think you will did autocomplete for single option using jquery ui plugin. but in this post you can learn multi selection autocomplete using jquery ui. In bellow preview you can see how will output of your multiselect autocomplete because its like choose js or something like plugin. But for layout i just add my own css. this example i use jquery ui js file and one more multiselect js file that file through we can do multi select and one more thing you can also customization of autocomplete.multiselect.js fi.....

By Hardik Savani | March 8, 2016 | | 35113 Viewer | Category : Javascript
READ MORE

PHP Image upload without refreshing page using jquery example

In this post i show you how to image upload without page reload using jquery ajax. jquery ajax through you can upload image and store record into database in php. i use jquery.form plugin for image uploading. So you can do by following few step of file uploading ajax jquery. <strong>Preivew</strong> <img width="100%" style="border:2px solid red" src="/upload/imageupload.png"> <br/> First you have to create index.php file as i do in following file, so create index.php file and put bellow code. <strong>index.php</strong> <pre class="code language-html"> <html lang="en"> <head> <ti.....

By Hardik Savani | March 4, 2016 | | 19982 Viewer | Category : Javascript
READ MORE

How to use each loop with class element of html in Jquery?

Whenever you need to use each loop in jquery then you can follow this example code. each with html class you can get whole object of that class using $(this) jquery function. In following example you can see i get attribute data-id using $(this).data('id'), that means you can take current class data attribute value. <strong>Example:</strong> <pre class="code language-html"> <html lang="en"> <head> <title>Each Loop with Class Jquery</title> <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> </head> <body> .....

By Hardik Savani | March 4, 2016 | | 1157 Viewer | Category : Javascript
READ MORE

How to get ckeditor value with tags on ajax-submit ?

If you are use ckeditor for textarea and you need to fore ajax submit or form js submit, but you can't find ckeditor value in your controller or php file. So, first you have to update field using CKEDITOR.instances. so you can try to following code. <pre class="language-javascript"> for ( instance in CKEDITOR.instances ) CKEDITOR.instances[instance].updateElement(); </pre>

By Hardik Savani | February 26, 2016 | | 2813 Viewer | Category : Javascript
READ MORE

    Bootstrap daterangepicker example code with demo using daterangepicker.js

    Bootstrap daterangepicker example code with demo using daterangepicker.js

    Open Post

    Automatically Refresh or Reload a Page using jQuery Example

    Automatically Refresh or Reload a Page using jQuery Example

    Open Post

    Laravel 5.2 - User ACL Roles and Permissions with Middleware using entrust from Scratch Tutorial

    Laravel 5.2 - User ACL Roles and Permissions with Middleware using entrust from Scratch Tutorial

    Open Post

    Laravel 5 - Barcode generator example using milon/barcode package

    Laravel 5 - Barcode generator example using milon/barcode package

    Open Post

    How to create custom facade in laravel 5.2?

    How to create custom facade in laravel 5.2?

    Open Post

    Laravel 5 Facebook authentication using Socialite Package

    Laravel 5 Facebook authentication using Socialite Package

    Open Post