Articles by "Javascript"

2019 4G LTE 4G VoLTE 5G 7th Pay Commission Aadhaar Actor Wallpapers Actress Wallpaper Adriana Lima AdSense Ahoi Ashtami Airtel Airtel DTH Akshay Kumar Alcatel Alexa Rank Amazon Android Android Pie Android Q Anna university Antivirus Anushka Sharma apna csc online Apple Apps Army Army App Asthma Asus Atal Seva mirchpur Athletics Auto Auto Insurance Avengers Axis Bank Backlinks Badhajmi Bajaj Bang Bang Reloaded Bank Battery Bhai Dooj Katha Bhakti Bharti Bhumi Pednekar Big Bazaar Big TV Bing BlackBerry Blogger BlogSpot Bluetooth BoB Bollywood Boot Boxing Breathlessness Browser BSEH Bsnl Budget Budhvar Business buy Cable TV Camera Car Car Loan Card Less ATM Cash CBSE Celebrity CEO Chandra Grahan Channels Chest Pain Chhath chrome Clean WhatsApp Cache Common Service Centres (CSC) Mirchpur Hisar Haryana - Front of Jyoti Sen Sec School Mirchpur Comparisons Computer Coolpad Corona COVID 19 COVID 19 HARYANA Credit Cricket Crime CSC Cylinder Dama Dard Deepika Padukone Defence Detel Dhanteras Diamond Crypto DigiLocker App DigiPay App Digital India App Digital Indian Gov Dish TV Diwali DNS setting Domain Donate Doogee DTH DTH Activation DTH Installation DTH Plans in India Dusshera E-seva Kender mirchpur Earn Money Education Electronics Email Entertinment Ex-serviceman Extensions Facebook FASTag Fatigue Festivals FlicKr Flipkart Foldable Smartphone Food Foursquare Funny Gadgets Galaxy Galaxy S8 Game Ganesh ganesh chaturthi Gas Problems Gastric Problem Gharelu Gionee Gmail God Google Google + Google Assistant Google Drive Google Duo Google Pixel Google Tez Google Voice Google+ Govardhan Puja GroupMe GST GTA Guide GuruSatsang Guruvar Hamraaz hamraaz app hamraaz app download hamraaz army hamraaz army app hamraaz army app download Hamraaz Army App version 6 Apk Happy New Year Hariyali Teej Hartalika Teej Harvard University Haryana haryana csc online HDFC Bank Headphones Health Heart Attack Heart Fail Heart Problems Heart Stroke Heena Sidhu Hello App Help Hernia Hindi History Hockey Holi Holi Katha Hollywood Home Loan Honor HostGator Hosting Hrithik Roshan HTC Huawei humraaz app iBall IBM ICICI Bank Idea Ilaj India india vs china indian army app Indigestion Infinix InFocus Information Infosys Instagram Insurance Intel Internet Intex Mobile iPad iPhone iPhone 8 IPL IRCTC iVoomi Jan Dhan Account Janmashtami Japanese Encephalitis Javascript JBL Jio Jio GigaFiber Jio Meet JioPOS JioRail JioSaavn Jokes Kamjori Karbonn Kareena Kapoor Kartik Purnima Karva Chauth Karwa Chauth Kasam Tere Pyaar Ki Katrina Kaif Kendall Jenner Keywords Kimbho Kodak Kumkum Bhagya Kushth Rog Landline Laptop Lava Lenovo Leprosy LET Lethargy LG Library of Congress Lifestyle Linkedin Lisa Haydon Livejournal Liver Cancer Loans LPG Gas mAadhaar Macbook Maha Shivratri Makar Sankranti Map Market Mary Kom Massachusetts Institute of Technology Meizu Messages Mi Micromax Microsoft Mobile Modi Mokshada Ekadashi Money Motorcycles Motorola Movie Muscle Pain Music Myspace Narendra Modi Narsingh Jayanti Nature Naukri Navratri Nemonia Netflix Network News Nexus Nia Sharma Nokia Notifications Nuskhe OBC Ocean Office Offrs Ola Cab OMG OnePlus Online Opera Oppo Oreo Android Orkut OS OxygenOS Padmavati PagalWorld Pain Pain Sensation Pakistan PAN PAN Card Panasonic Passwords Patanjali Pay Payment Paypal Paytm PC PDF Peeda Pendrive Pension Personal Loan Pet Me Gas PF Phone Photo PHP Pila Bukhar Pinterest Pixel Plan PNB Bank Pneumonia PNR Poco Poster PPC Pradhan Mantri Kisan Samman Nidhi Pradhanmantri Kisan Samman Nidhi Yojna Pradosh Pragya Jaiswal Prepaid Princeton University Printer Priyanka Chopra promote my youtube channel promote video on youtube cost promote youtube channel promote youtube channel free promote youtube video free PUBG Qualcomm Quora Quotes Race 3 Railway Rambha Tritiya Vrat RBI Realme Recruitment Redmi Relationship Religious Restore Results Review Rule Sai Dharam Tej Saina Nehwal Salman Khan Samsung Sanusha Satsang Video Sawan Somvar Vrat SBI Bank Script Sell SEO Serial Server Shabd Shahid Kapoor Shanivar Sharad Poornima Sharp Shiv Shopping Shreyasi Singh Shruti Haasan Signal Sim Smart Android TV Smartphones SMS Snapchat Social Software Somvar Sonakshi Sinha Sonam Kapoor Soney Songs Sony Xperia Space Speakers Specifications Sports Sql Stanford University State Bank of India Stickers Stomach Upset Story Sun Direct Sunny Leone Surabhi Sushant Singh Rajput Swadeshi Swas Rog Tata Sky Tax Tech Technology Tecno Telegram Telugu Thakan Tiger Shroff Tiger Zinda Hai Tips Tiredness Tollywood Tool Top Trending People Trading Trai TRAI Rules for cable TV Trailer Treatment Trends True Things Truecaller Tubelight Tulsi Vivah Tumblr Tv Twitter Typing Uber Umang App University of Oxford UP Board Upay Upchar Update USA USB Vacancies Valentines Day Verizon Vertu Viber Video Videocon d2h Videos Vijayadashami Viral Bukhar Viral Fever Virat Kohli Virgin Visas Vivo VLE Vodafone Voter Card VPN Vrat Katha Vrat Vidhi Wallpaper War Wayback Machine Weakness WhatsApp WhatsApp Cleaner WhatsApp Status WhatsApp stickers Wi-Fi WiFi Windows Windows 10 Wipro Wireless WordPress workstation WWE Xiaomi Xiaomi Mi 6 Yeh Hai Mohabbatein Yellow Fever Yo Yo Honey Singh Yoga yojna YotaPhone YouTube youtube promotion youtube promotion free ZTE अपच अस्थमा आलस्य इलाज उपचार उपाय उमंग ऐप कहानियाँ कुष्ठरोग कोरोना वायरस गुरुसत्संग घरेलू जन धन योजना जापानी इन्सेफेलाइटिस डिजिटल इंडिया डिजिटल इंडिया अप्प्स डिजिपे ऐप डिजीलॉकर ऐप थकान दमा दर्द निमोनिया नुस्ख़े पीड़ा पीतज्वर पीला बुखार पेट में गैस पैन कार्ड प्रधानमंत्री किसान सम्मान निधि बदहज़मी भक्ति मांसपेशियों में दर्द लीवर कैंसर वायरल बुखार वोटर कार्ड शब्द सच्ची बातें सत्संग वीडियो सरसों सीने में दर्द स्कीम स्वास रोग हर्निया
Showing posts with label Javascript. Show all posts

The instant search feature has massively changed the web in past couple of weeks. I had developed real-time Youtube instant search with Jquery and Ajax. It is very simple like my previous posts, just reading the Youtube API JSON file with Jquery.

Javascript Code
$(".search_input").keyup(function(){})search_input is the class name of input tag. $(this).val() - calling the input search box value. The encodeURIComponent() function encodes special characters (More infomation). 
<script type="text/javascript" src="http://ajax.googleapis.com/
ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{

$(".search_input").keyup(function()
{
var search_input = $(this).val();
var keywordencodeURIComponent(search_input);
// Youtube API 
var yt_url='http://gdata.youtube.com/feeds/api/videos?q='+keyword+'&format=5&max-results=1&v=2&alt=jsonc';

$.ajax
({
type: "GET",
url: yt_url,
dataType:"jsonp",
success: function(response)
{

if(response.data.items)
{
$.each(response.data.items, function(i,data)
{
var video_id=data.id;
var video_title=data.title;
var video_viewCount=data.viewCount;
// IFRAME Embed for YouTube
var video_frame="<iframe width='640' height='385' src='http://www.youtube.com/embed/"+video_id+"' frameborder='0' type='text/html'></iframe>";

var final="<div id='title'>"+video_title+"</div><div>"+video_frame+"</div><div id='count'>"+video_viewCount+" Views</div>";

$("#result").html(final); // Result

});
}
else
{
$("#result").html("<div id='no'>No Video</div>");
}
}
});
});
});
</script>
// HTML code
<input type="text" class='search_input' />
<div id="result">
</div>

Youtube JSON file
JSON file keyword : Twitter Oauth 9lessons
{
"apiVersion":"2.0",
"data":
{
"updated":"2010-09-29T12:44:49.913Z",
"totalItems":2,
"startIndex":1,
"itemsPerPage":1,
"items":[{
"id":"yhrbmUbF0IE",
"uploaded":"2010-02-23T18:21:03.000Z",
"updated":"2010-09-21T01:50:37.000Z",
"uploader":"9lessons",
"category":"Tech",
"title":"Twitter Oauth Connect",
"description":"labs.9lessons application to twitter oauth connect using PHP",
"tags":["PHP","twitter","Oauth"],
"thumbnail":
{
"sqDefault":"http://i.ytimg.com/vi/yhrbmUbF0IE/default.jpg",
"hqDefault":"http://i.ytimg.com/vi/yhrbmUbF0IE/hqdefault.jpg"
},
"player":
{
"default":"http://www.youtube.com/watch?v\u003dyhrbmUbF0IE&feature\u003dyoutube_gdata_player",
"mobile":"http://m.youtube.com/details?v\u003dyhrbmUbF0IE"},
"content":
{
"1":"rtsp://v6.cache2.c.youtube.cb3MM/0/0/0/video.3gp",
"5":"http://www.youtube.com/v/yhrbmUdata",
"6":"rtsp://v6.cache7.c.youtube.com/.3gp"
},
"duration":93,
"rating":3.0,
"likeCount":"1",
"ratingCount":2,
"viewCount":2481,
"favoriteCount":1,
"commentCount":1,
"accessControl":
{
"syndicate":"allowed",
"commentVote":"allowed",
"rate":"allowed",
"list":"allowed",
"comment":"allowed",
"embed":"allowed",
"videoRespond":"moderated"
}}
]
}
}

CSS
body 
{
background-color:#86c9ef;
color:#000;
font-family:'Georgia', Times New Roman, Times, serif
}
#result
{
background-color:#000;
margin-top:25px;
min-height:400px;
width:640px;
border:solid 10px #ffffff;
-moz-border-radius:9px;
-webkit-border-radius:9px;
}
#no
{
padding:30px;
font-size:24px;
color:#fff;
}
#title
{
background-color:#fff;
font-size:26px;
text-align:left;
padding-bottom:8px;
}
#count
{
background-color:#fff;
text-align:left;
padding-top:8px;
}

In this post I want to explain how to display Twitter Oauth home time line with Jquery and PHP. it is very simple just follow this post. I hope you like this.

Twitter Home Timeline JSON File
Take a look at blue color bold words. 
{ "posts":[
{
"favorited": false,
"contributors": null,
"truncated": false,
"text": "9lessons blog http://9lessons.info",
"created_at": "Tue Sep 14 06:48:09 +0000 2010",
"retweeted": false,
"coordinates": null,
"source": "<a href="http://labs.9lessons.info">labs</a>",
"in_reply_to_status_id": null,
"in_reply_to_screen_name": null,
"in_reply_to_user_id": null,
"place": null,
"retweet_count": null,
"geo": null,
"id": 24454801041, // Tweet Id
"user":
{
"follow_request_sent": false,
"profile_use_background_image": true,
"id": 15761916, //User Id
"verified": false,
"profile_sidebar_fill_color": "FFFFFF",
"profile_text_color": "000000",
"followers_count": 2242,
"protected": false,
"location": "Chennai, INDIA",
"profile_background_color": "dedede",
"listed_count": 170,
"utc_offset": 19800,
"statuses_count": 1097,
"description": "Engineer, Blogger, I love skyblue web",
"friends_count": 80,
"profile_link_color": "ad0000",
"profile_image_url": "http://url/srinivas_normal.jpg",
"notifications": false,
"show_all_inline_media": false,
"geo_enabled": false,
"profile_background_image_url": "http://url/newbgx.png",
"name": "Srinivas Tamada ",
"lang": "en",
"profile_background_tile": false,
"favourites_count": 9,
"screen_name": "9lessons",
"url": "http://9lessons.info",
"created_at": "Thu Aug 07 10:47:26 +0000 2008",
"contributors_enabled": false,
"time_zone": "Chennai",
"profile_sidebar_border_color": "333333",
"following": true
}
},

{
// Second Tweet...
},
{
// Third Tweet...
}

]}

home.php
Contains javascript and PHP code. $(".mytweets").click(function(){}) - mytweets is the class name of anchor tag using $.getJSON() functions calling tweets.json file with passing $user_session.
<script type="text/javascript" src="http://ajax.googleapis.com/
ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.timeago.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(".mytweets").click(function()
{
$.getJSON("tweets.json?user=<?php echo $user_session;?>",
function(data)
{
$.each(data.posts, function(i,data)
{
// Reading JSON file take a look at above code bold blue color words.
var id=data.id;
var text=data.text;
var created_time=data.created_at;
var screen_name=data.user.screen_name;
var image=data.user.profile_image_url;
var source=data.source;

var div_data ="<div class='twitter_status' id='"+id+"'><img src="+image+" class='twitter_image'/><a href='http://twitter.com/"+screen_name+"'>"+screen_name+"</a> "+text+"<br/><div class='twitter_posted_at'><span class='timeago' title='"+created_time+"'></span><i>via "+source+" </i></div></div>";
$(div_data).appendTo(".tweets");
$(".timeago").timeago(); // jquery timeago plugin converting into timestamp
});
});
return false;
});
});
</script>
<a href='#' class='mytweets'>My Tweets </a> 
<div class='tweets'></div>

.htaccess file code
$.getJSON function much flexible .json So that using .htacces file rewriting tweets.php to tweets.json.
RewriteEngine on

RewriteRule tweets.jsontweets.php

Library http://github.com/jmathai/twitter-async

tweets.php (About JSON code is the output)
Contains PHP code you can download the library files from my previous post. Using method get_statusesHome_timeline() getting twitter home timeline json file. More information about methods click here
<?php
include("db.php");
include 'EpiCurl.php';
include 'EpiOAuth.php';
include 'EpiTwitter.php';
$consumerKey='xxxxxxxxxxxxxxxxxxxx';
$consumerSecret='xxxxxxxxxxxxxxxxxxxx';

if($_GET['user'])
{
$user=$_GET['user']; // user session
// Getting stored oauth_token and oauth_token_secret values form users table
$sql=mysql_query("select oauth_token,oauth_token_secret from users where user='$user'");
$row=mysql_fetch_array($sql);
$oauthToken=$row['oauth_token'];
$oauthSecret=$row['oauth_token_secret'];
if(strlen($oauthToken)&gt;5 && strlen($oauthSecret)>5 )
{
$Twitter = new EpiTwitter($consumerKey, $consumerSecret);
$Twitter->setToken($oauthToken,$oauthSecret);
$hometimeline = $Twitter->get_statusesHome_timeline();
$tweets=json_encode($hometimeline-&gt;response);
$final = '{"posts":'.$tweets.'}';
echo $final;
}
}
?>

CSS
.twitter_status
{
min-height:60px;
padding:6px;
border-bottom:solid 1px #DEDEDE
}
.twitterr_status a
{
color:#3cf;
text-decoration:none
}
.twitterr_status a:hover{
color:#3cf;
text-decoration:underline
}
.twitter_image{
float:left;
margin-right:14px;
width:50px;
height:50px;
padding:3px;
}
.twitter_posted_at{
font-size:11px;
padding-top:4px;
color:#999
}

How to do dynamic dependent select box using Jquery, Ajax, PHP and Mysql. Dependent select box when a selection is made in a "Parent" box it allow to refresh a "child" box list data. In this post I had given a database relationship example betweent "category" and "subcategory". It's very simple jquery code hope you like this.

Database
Sample database tables. Data table contains list boxes complete data, data_parenttable foreign key relationship with Data table contains parent and child relation.
CREATE TABLE 'data'
(
'id' int primary key auto_increment,
'data' varchar(50),
'weight' int(2),
);

CREATE TABLE `data_parent`
(
`pid` int(11) primary key auto_increment,
`did` int(11) unique,
`parent` int(11),
Foreign key(did) references data(id)
)

Data storing like this.
data data_parent


sections_demo.php
Contains javascipt and PHP code. $(".country").change(function(){}country is the class name of select box. Using $(this).val() calling select box value. PHP code displaying results from data table where weight='1'
<script type="text/javascript" src="http://ajax.googleapis.com/
ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(".country").change(function()
{
var id=$(this).val();
var dataString = 'id='+ id;

$.ajax
({
type: "POST",
url: "ajax_city.php",
data: dataString,
cache: false,
success: function(html)
{
$(".city").html(html);
}
});

});

});
</script>
//HTML Code
Country :
<select name="country" class="country">
<option selected="selected">--Select Country--</option>
<?php
include('db.php');
$sql=mysql_query("select id,data from data where weight='1'");
while($row=mysql_fetch_array($sql))
{
$id=$row['id'];
$data=$row['data'];
echo '<option value="'.$id.'">'.$data.'</option>';
?>
</select> <br/><br/>

City :
<select name="city" class="city">
<option selected="selected">--Select City--</option>
</select>

ajax_city.php
Contains PHP code. Displaying results from data and date_parent tables
<?php
include('db.php');
if($_POST['id'])
{
$id=$_POST['id'];
$sql=mysql_query("select b.id,b.data from data_parent a,data b where b.id=a.did and parent='$id'");
while($row=mysql_fetch_array($sql))
{
$id=$row['id'];
$data=$row['data'];
echo '<option value="'.$id.'">'.$data.'</option>';
}
}
?>

Digitalindiagov.com

Satish Kumar

Contact Form

Name

Email *

Message *

Powered by Blogger.