Category : Javascript


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 | | 7351 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 | | 661 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 | | 1278 Viewer | Category : Javascript
READ MORE

How to get max attribute value in jquery?

Sometimes, you have a many tag with same class and attribute with value, but you need to find maximal value of attribute from that comman class, In bellow you have same html tag: <pre class="code language-html"> <ul> <li class="test" data-id="3">hi</li> <li class="test" data-id="5">hey</li> <li class="test" data-id="1">hello</li> </ul> </pre> Now, you require to get max value, i mean you need to 5, because that is big value from other, so you can get maximal value from this way: <pre class="language-javascript"> var max = 0; $('.test').each(fu.....

By Hardik Savani | February 23, 2016 | | 630 Viewer | Category : Javascript
READ MORE

Crop, Resize, Frames etc on selected image in php using Aviary

Whenever you require to use any image plugin for select image and crop,resize,effects,frames,strickers ect, so you have to use Aviary api like as you see of facebook, twitter ect., that site plugin provide lots of efects and api guide that way you can use easily in your web app and as well as on mobile app too. So, I am going to give demo of how to use this api in our side. <strong>Preview:</strong> <img style="border:2px solid cadetblue;width:100%" src="/upload/selectimage.png"> <strong>Example</strong> <pre class="code language-html"> <html> <head> <title>Aviary Image U.....

By Hardik Savani | February 16, 2016 | | 3415 Viewer | Category : Javascript
READ MORE

How can i print php variable in jquery?

If you are working on php and you need to print your php variable inside the javascript then you can simple get value. you can use "" for get value of php variable. in following example you can see : <strong>Example:</strong> <pre class="code language-html"> <script type="text/javascript"> var my_var = "<?php echo $my_variable; ?>"; console.log(my_var); </script> OR <script type="text/javascript"> var my_var = <?php echo $my_variable; ?>; console.log(my_var); </script> </pre> But, you can use on php file, Not on js file.

By Hardik Savani | February 8, 2016 | | 1020 Viewer | Category : Javascript
READ MORE

Select only one checkbox at a time using Jquery

If you need to select one checkbox at a time in multiple checkbox, i mean you want to allow anly one checkbox user can check then you can do easily using jquery. jquery prop() through you can give attribute value checked equel to true or false. if you have banch of checkbox like as example, and if you want to check checkbox at time one by using jquery then you can use this code. In following example use for you to do select at a time one. <strong>Example:</strong> <pre class="code language-html"> <html> <head> <title>Select only one checkbox at time</title> <scri.....

By Hardik Savani | February 5, 2016 | | 9006 Viewer | Category : Javascript
READ MORE

How to check undefined, empty and null in JavaScript/JQuery ?

If you are working on jquery and However you want to check variable is undefined or not then you can easily check by typeof operator, which is simple, fast and cross-platform: <pre class="language-javascript"> if(typeof i == "undefined"){ alert('undefined'); } </pre> If you are working on jquery and However you want to check variable is empty or not then you can easily check by compare with empty string: <pre class="language-javascript"> if(i == ''){ alert('Empty'); } </pre> If you are working on jquery and However you want to check variable is null or not then you can easily che.....

By Hardik Savani | January 12, 2016 | | 613 Viewer | Category : Javascript
READ MORE

How to convert line breaks to br in jQuery ?

If you are use textarea and you want to like break into br(\n) so that way we can give format as user insert, but if you are working on php then you can easily doing with nl3br() through, but if you are using in jquery or javascript then you have to first declare that. i did give full example of jquery textarea line breaks as under. <pre class="code language-html"> <body> <textarea class="textareac"></textarea> <script> var text_content = <?php echo $content ?>; function nl2br (str, is_xhtml) { var breakTag = (is_xh.....

By Hardik Savani | January 9, 2016 | | 855 Viewer | Category : Javascript
READ MORE

How to check Object is empty or not in Jquery/JavaScript ?

you can check your JavaScript OR jQuery object is empty or not, because we need to check many place our jQuery object is empty, null or undefined etc., So usually, we can check using $.isEmptyObject() as i explained as under. how to check empty object in javascript, how to check empty object in jquery, jQuery.isEmptyObject() example, jquery check object is null, jquery check object is empty, jquery check object is empty or not, how to check json object is empty or not in jquery, check if json object is empty jquery <pre class="language-javascript"> if($.isEmptyObject(your_object)){ alert(.....

By Hardik Savani | January 8, 2016 | | 11405 Viewer | Category : Javascript
READ MORE

    How to implement infinite ajax scroll pagination in Laravel 5?

    How to implement infinite ajax scroll pagination in Laravel 5?

    Open Post

    How to get Instagram followers count using JQuery Ajax?

    How to get Instagram followers count using JQuery Ajax?

    Open Post

    Laravel 5 dropbox api file upload example using league/flysystem-dropbox package

    Laravel 5 dropbox api file upload example using league/flysystem-dropbox package

    Open Post

    Laravel 5 - How to prevent browser back button after user logout?

    Laravel 5 - How to prevent browser back button after user logout?

    Open Post

    Laravel 5 - Full Text Search Example using Scout and Algolia Packages

    Laravel 5 - Full Text Search Example using Scout and Algolia Packages

    Open Post

    Laravel 5 - whereIn and whereNotIn with subquery example using query builder

    Laravel 5 - whereIn and whereNotIn with subquery example using query builder

    Open Post