Skip to main content

Posts

Showing posts from March, 2020

if jQuery contain and match value then replace with another value on load in jQuery?

if jQuery contain and match value then replace with another value on load in jQuery. $(window).on("load", readyFn); function readyFn() {    $('#chart-container text').each(function() { var ourText = $(this).text().toLowerCase(); // convert text to Lowercase if(ourText.match('75%')) { $(this).html( "h" ); }      }); }

How to get Selected Option Text of HTML SELECT using jQuery?

Get Selected Option Text of HTML SELECT using jQuery < select   id ="mySelect">      < option   value ="1"> hello </ option >      < option   value ="2"> bro </ option > </ select > < input   type ="button"   id =" test "   value   =   " test "   /> < script   type ="text/javascript">     $( "#test" ).live( "click" ,  function  () {                   var  selectedText = $( "#mySelect option:selected" ).html();         alert(selectedText);     }); </ script >

How to get full detail of any mobile number in cordova?

Get full detail of any mobile number in cordova. document.addEventListener("deviceready", hello, false); function hello(){ navigator.contacts.pickContact(function(contact){  console.log('The following contact has been selected:' + JSON.stringify(contact));   document.getElementById("number").innerHTML = 'The following contact has been selected:' + JSON.stringify(contact);     },function(err){         console.log('Error: ' + err);     }); }

How to get all contacts and count contact numbers from mobile in cordova?

Get  all contacts and count contact numbers from mobile in cordova. document.addEventListener("deviceready", jaspreet, false); function jaspreet() {    //    //    // after deviceready    //    //    navigator.contactsPhoneNumbers.list(function(contacts) {       console.log(contacts.length + ' contacts found');   alert(contacts.length);       for(var i = 0; i < contacts.length; i++) {          console.log(contacts[i].id + " - " + contacts[i].displayName);          for(var j = 0; j < contacts[i].phoneNumbers.length; j++) {             var phone = contacts[i].phoneNumbers[j];             console.log("===> " + phone.type + "  " + phone.number + " (" + phone.normalizedNumber+ ")"); document.getElementById("names").innerHTML +=phone.type + "  " + phone.number;          }       }    }, function(error) {       console.error(error);    });

How to get unique mobile ID (device Id) from mobile in cordova?

Get unique mobile ID (device Id)  from mobile in cordova.   <script type="text/javascript" charset="utf-8">     // Wait for Cordova to load     //     document.addEventListener("deviceready", onDeviceReady, false);     // Cordova is ready     //     function onDeviceReady() {         var element = document.getElementById('deviceProperties');         element.innerHTML = 'Device Name: '     + device.name     + '<br />' +                             'Device Cordova: '  + device.cordova  + '<br />' +                             'Device Platform: ' + device.platform + '<br />' +                             'Device UUID: '     + device.uuid     + '<br />' +                             'device model: '     + device.model     + '<br />' +                             'device manufacturer: '     + device.manufact

How to get values and parameters from url with jquery in cordova with example?

Get values and parameters from url with jquery in cordova with example Paste in Function.php file  function check_login(){    if(function_exists('date_default_timezone_set')) {     date_default_timezone_set("Asia/Kolkata"); } // then use the date functions, not the other way around $date = date("d/m/Y"); $date1 =  date("H:i a"); $phone = $_POST['phone']; $password = $_POST['pass']; global $wpdb; $table_name = $wpdb->prefix ."customer";  $result = $wpdb->get_results ( "SELECT * FROM $table_name WHERE phone='$phone' AND password='$password'" ); $count_users = count($result); foreach($result as $print_result){ }  if($count_users>0){     //echo '<script>window.location.href="dashboard.html";</script>';  echo $print_result->ID;   } else{   echo 'null';    }

How to Get URL parameters & values from url in jQuery?

function function getUrlVars() {     var vars = [], hash;     var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');     for(var i = 0; i < hashes.length; i++)     {         hash = hashes[i].split('=');         vars.push(hash[0]);         vars[hash[0]] = hash[1];     }     return vars; } Url http://www.example.com/jassi.html?me=myValue&name2=SomeOtherValue OR http://www.example.com/?me=myValue&name2=SomeOtherValue Usage var first = getUrlVars()["me"]; // To get the second parameter var second = getUrlVars()["name2"];

How to fetch data from database in cordova app with ajax in wordpress?

fetch data from database in cordova app with ajax in wordpress. Paste in funtion.php file.  function fetch_cordova_message(){ if(function_exists('date_default_timezone_set')) { date_default_timezone_set("Asia/Kolkata"); } // then use the date functions, not the other way around $date = date("d/m/Y"); $date1 =  date("H:i a"); global $wpdb; $table_name = $wpdb->prefix ."customer"; $result = $wpdb->get_results ( "SELECT * FROM $table_name Order by ID desc" ); foreach ( $result as $print )  {             echo'<div class="list_row"><div class="per_name">'.$print->person .'</div><div class="full_view">></div></div>';         } die();  }  add_action('wp_ajax_nopriv_fetch_cordova_message','fetch_cordova_message');  add_action('wp_ajax_fetch_cordova_message','fe

How to insert data in database with ajax in cordova?

Insert data in database with ajax in cordova. Paste in function.php file  function insert_cordova_message(){  if(function_exists('date_default_timezone_set')) {     date_default_timezone_set("Asia/Kolkata"); } // then use the date functions, not the other way around $date = date("d/m/Y"); $date1 =  date("H:i a"); $person = $_POST['person']; $email = $_POST['email']; $phone = $_POST['phone']; $password = $_POST['pass']; global $wpdb; $table_name = $wpdb->prefix ."customer"; $wpdb->insert($table_name, array('person' => $person, 'email' => $email,'phone' => $phone, 'password' => $password,'registered_date' => $date) );   die();  }  add_action('wp_ajax_nopriv_insert_cordova_message','insert_cordova_message');  add_action('wp_ajax_insert_cordova_message','insert_cordova_message');

How to create session in cordova app with jquery (ajax) in wordpress?

Create session in cordova app with jquery in wordpress. Paste in function.php file. function check_login(){  if(function_exists('date_default_timezone_set')) {     date_default_timezone_set("Asia/Kolkata"); } // then use the date functions, not the other way around $date = date("d/m/Y"); $date1 =  date("H:i a"); $phone = $_POST['phone']; $password = $_POST['pass']; global $wpdb; $table_name = $wpdb->prefix ."customer";  $result = $wpdb->get_results ( "SELECT * FROM $table_name WHERE phone='$phone' AND password='$password'" ); $count_users = count($result); foreach($result as $print_result){ }  if($count_users>0){     //echo '<script>window.location.href="dashboard.html";</script>';  echo $print_result->ID;   } else{   echo 'null';    }   die();  }  add_action('wp_ajax_nopriv_c

How to get multiple values from ajax in wordpress?

Get multiple values from ajax in wordpress. Paste this code in main file.  function single_user_data(){ var ajax = "http://wpcodekit.com/wp-admin/admin-ajax.php";    var data = { 'action' : "get_single_use", 'ID': user_id } $.post(ajax,data,function(response){ var result = $.parseJSON(response) $(".first").html(result[0]); $(".second").html(result[1]); console.log(response); }); } single_user_data(); Paste this code in function.php file.  function get_single_use(){     $user_id = $_POST['ID'];   if(function_exists('date_default_timezone_set')) { date_default_timezone_set("Asia/Kolkata"); } // then use the date functions, not the other way around $date = date("d/m/Y"); $date1 =  date("H:i a");

How to upload file into wordpress child theme folder in wordpress ( file upload) ?

upload file into wordpress child theme folder in wordpress ( file upload) if(isset($_POST["submit_p_img"])){ $filename = $_FILES["p_img"]["name"]; $tempname = $_FILES["p_img"]["tmp_name"]; echo $folder =  $_SERVER["DOCUMENT_ROOT"]."/messanger/wp-content/themes/twentytwenty-child/pimg/".$filename; move_uploaded_file($tempname,$folder); }

How to fetch data by limit in php (How to use sqi in sql in php) (two mysqls)?

 fetch data by limit in php (How to use sqi in sql in php) (two mysqls) $msg_content = $_POST['msg_content']; $own_id = $_POST['own_id']; $user_id = $_POST['user_id']; global $wpdb; $table_name13 = $wpdb->prefix . "user_chats"; $results = $wpdb->get_results("select  from (select  from $table_name13 where (sender_id ='$own_id' AND receiver_id='$user_id') OR (sender_id ='$user_id' AND receiver_id='$own_id') order by ID DESC LIMIT 10) $table_name13 order by ID"); $total = count($results); foreach($results as $result){ $sender_id = $result->sender_id; $receiver_id = $result->receiver_id; if($sender_id == $own_id AND $receiver_id == $user_id){ echo " <div class='right_side_chat' style='text-align:right;background:blue; margin-left:30%; margin-bottom:4px; padding:5px 10px;'> <span>$result->ID</span> &l