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'); ...