Get URL Parameters using jQuery To implement this, I have created a function which returns value of any parameters variable. function GetURLParameter(sParam) { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == sParam) { return sParameterName[1]; } } } And this is how you can use this function assuming the URL is, " http://dummy.com/?technology=jquery&blog=jquerybyexample ". var tech = GetURLParameter('technology'); var blog = GetURLParameter('blog'); So in above code variable " tech " will have " jquery " as value and " blog " variable's will be " jquerybyexample ". Source from: http://www.jquerybyexample.net/2012/06/get-url-parameters-using-jquery...
To get a time different between now and input time if you want to check the different between now and set date. you can use this function. function time_passed ( $timestamp ) { //type cast, current time, difference in timestamps $timestamp = ( int ) $timestamp ; $current_time = time ( ) ; $diff = $current_time - $timestamp ; //intervals in seconds $intervals = array ( 'year' => 31556926 , 'month' => 2629744 , 'week' => 604800 , 'day' => 86400 , 'hour' => 3600 , 'minute' => 60 ...
留言
張貼留言