Top Questions:

  • 3 years-4 months

    Rss Script

    • Category : jquery
    • Location : Chandigarh
    • Posted On :
    • Posted by : Guley
    <script type="text/javascript">
    
    var cssfeed=new gfeedfetcher("example1", "example1class", "")
    cssfeed.addFeed("CSS Drive", "your rss link") //Specify "label" plus URL to RSS feed
    cssfeed.displayoptions("date") //show the specified additional fields
    cssfeed.setentrycontainer("li") //Display each entry as a list (li element)
    cssfeed.filterfeed(10, "title") //Show 10 entries, sort by date
    cssfeed.init() //Always call this last
    
    </script>

     

  • 3 years-4 months

    Loader

    • Category : html
    • Location : Chandigarh
    • Posted On :
    • Posted by : Guley
    <html>
    <head>
    <style>
      .js div#preloader { position: fixed; left: 0; top: 0; z-index:99999; width: 100%; height: 100%; overflow: visible; background:#FFFFFF url('images/load.gif') no-repeat center center;background-size:30%;}
    .ui-loader.ui-corner-all.ui-body-a.ui-loader-default {display: none;}
      </style>
    </head>
     <div class="js">
    <body>
    <div id="preloader"></div> 
    </body>
    </div>
    </html>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script>
    /*====================================================== start */
    
    
    jQuery(document).ready(function($) {  
    
    // site preloader -- also uncomment the div in the header and the css style for #preloader
    $(window).load(function(){
      $('#preloader').fadeOut('10000',function(){$(this).remove();});
    });
    });
    /*====================================================== end */
    </script>

     

  • 3 years-4 months

    Menu Active

    • Category : jquery
    • Location : Chandigarh
    • Posted On :
    • Posted by : Guley
    $(function(){
        // this will get the full URL at the address bar
        var url = window.location.href; 
        // passes on every "a" tag 
        $(".main-nav li a").each(function() {
                // checks if its the same on the address bar
            if(url == (this.href)) { 
                $(this).closest("li").addClass("current");
            }
        });
    });

     

  • 3 years-4 months

    Confirm Alert

    • Category : jquery
    • Location : Chandigarh
    • Posted On :
    • Posted by : Guley

    add confirmation alert before your link active

    <script>
    function confirmDelete(delUrl) {
      if (confirm("Are you sure you want to delete")) {
        document.location = delUrl;
      }
    }
    </script>
    
    <a href="javascript:confirmDelete('delete.page?id=1')">Delete</a>
    
    or
    
    <a href="delete.page?id=1" onclick="return confirm('Are you sure you want to delete?')">Delete</a>
    
    or
    use this cdn's in your header
    
    https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.css
    https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.js
    
    
    <a href="delete.page?id=1" class="confirmation">Delete</a>
    
    jQuery('.confirmation').click(function (e) {
        var href = jQuery(this).attr('href');
    
        swal({
            title: "Are you sure?",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes",
            cancelButtonText: "No",
            closeOnConfirm: true,
            closeOnCancel: true
        },
                function (isConfirm) {
                    if (isConfirm) {
                        window.location.href = href;
                    }
                });
    
        return false;
    });
    

  • 3 years-4 months

    Auto upload Picture

    • Category : php
    • Location : Chandigarh
    • Posted On :
    • Posted by : Guley
    <form action="" method="post" enctype="multipart/form-data" class="upload_bus"> 
    div class="btn-group col-lg-3 col-md-3 col-sm-6 col-xs-12 rightgp-btns">
      <input class="create-doc" id="upbuss"  type="file" name="upbus" >
    </div>
    </form>
    <center><div id="loader-icon" style="display:none;"><img src="images/loader-time.gif" height="100px" width="100px" /></div></center>
    <script>
    $('input#upbill').change(function(){
    $('form.upload_b').submit();
    })
    $('form.upload_b').submit(function(e){
      var formData = new FormData(this);
      $('#loader-icon').show();
    $.ajax({
    url: "upload_file.php",            
    type: "POST",
    data:  formData,
    mimeType:"multipart/form-data",
    contentType: false,
    cache: false,
    processData:false,
    success: function(data)
    {
      $('#loader-icon').hide();
       window.location.href="example.php";
    }
    });
    return false;
    });
    </script>

     

  • 3 years-4 months

    Picture onupload button

    • Category : php
    • Location : Chandigarh
    • Posted On :
    • Posted by : Guley
    <label for="fileToUpload"><img src="images/fileupload.png" id="blah1" width="50" height="50"/></label><input type="file" name="exmaple" id="fileToUpload" onchange="$('#blah1')[0].src = window.URL.createObjectURL(this.files[0])"  required>
    <style>
    .image-upload > input[type=file]
    {
        display: none !important;
     z-index: 0 !important;
    }
    </style>

     

  • 5 years-11 months

    .htaccess Tricks To Speed Up Your Website

    • Category : htaccess
    • Location : Chandigarh, India
    • Posted On :
    • Posted by : Vikas

    Speed-up your website with these simple .htaccess tricks

    # Do not remove this line or mod_rewrite rules and search engine friendly URLs will stop working
    RewriteBase /
    
    # BEGIN Cache-Control Headers
    <ifModule mod_headers.c>
     <filesMatch ".(ico|jpe?g|png|gif|swf)$">
       Header set Cache-Control "public"
     </filesMatch>
     <filesMatch ".(css)$">
       Header set Cache-Control "public"
     </filesMatch>
     <filesMatch ".(js)$">
       Header set Cache-Control "private"
     </filesMatch>
     <filesMatch ".(x?html?|php)$">
       Header set Cache-Control "private, must-revalidate"
     </filesMatch>
    </ifModule>
    # END Cache-Control Headers
    
    <ifmodule mod_expires.c>
    <Filesmatch "\.(jpg|jpeg|png|gif|js|css|swf|ico|woff|mp3)$">
        ExpiresActive on
        ExpiresDefault A2592000
    </Filesmatch>
    </ifmodule>
    
  • 5 years-11 months

    how to post data using ajax

    • Category : php
    • Location : Chandigarh, India
    • Posted On :
    • Posted by : Vikas

    1 Answers

    View More

    vikas image

    Name: vikas

    Experiance: 5 years-11 months

    answered
    Dec 08, 2015 at 11:00

    create file result.php

    <?php
    if( $_REQUEST["name"] ) {
    
       $name = $_REQUEST['name'];
       echo "Welcome ". $name;
    }
    
    ?>

    create your html file with this code

    <html>
    
       <head>
          <title>The jQuery Example</title>
          <script type = "text/javascript" 
             src = "http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
       
          <script type = "text/javascript" language = "javascript">
             $(document).ready(function() {
          
                $("#driver").click(function(event){
           
                   $.post( 
                      "result.php",
                      { name: "Zara" },
                      function(data) {
                         $('#stage').html(data);
                      }
                   );
             
                });
           
             });
          </script>
       </head>
     
       <body>
     
          <p>Click on the button to load result.html file %u2212</p>
        
          <div id = "stage" style = "background-color:cc0;">
             STAGE
          </div>
        
          <input type = "button" id = "driver" value = "Load Data" />
       
       </body>
      
    </html>

  • 5 years-11 months

    how to get zip to address

    • Category : php
    • Location : Chandigarh, India
    • Posted On :
    • Posted by : Vikas

    1 Answers

    View More

    vikas image

    Name: vikas

    Experiance: 5 years-11 months

    answered
    Dec 07, 2015 at 15:33

    <?php
    class ZiptoAddress()
    {
    function getLnt($zip)
    {
    $url = "http://maps.googleapis.com/maps/api/geocode/json?address=".$zip."&sensor=false";
    $result_string = file_get_contents($url);
    $result = json_decode($result_string, true);
    //$result1[]=$result['results'][0];
    //$result2[]=$result1[0]['geometry'];
    //$result3[]=$result2[0]['location'];
    //return $result[0];
    //return $result['results'][0]['geometry']['location'];
    return $result['results'][0];
    //print_r($result1[0]['formatted_address']);
    }
    }
    $val = getLnt('90001');
    echo "Address: ".$val['formatted_address']."<br>";
    echo "Latitude: ".$val['geometry']['location']['lat']."<br>";
    echo "Longitude: ".$val['geometry']['location']['lng']."<br>";
    ?>