Facebook like auto suggestion with jquey, ajax with jsp also developed by 9lessons in php i never found this tutorial in java o jasp anywhere and i got many requests from users who are reading frequently.I lhope you like it.Automatically based on the query you search the values will be listed.
Download Script: Download File
Database: Actually i used ms access to connect with jsp,if you use mysql or oracle below code useful
Download Script: Download File
Database: Actually i used ms access to connect with jsp,if you use mysql or oracle below code useful
CREATE TABLE test_user_data ( uid INT AUTO_INCREMENT PRIMARY KEY, fname VARCHAR(25), lname VARCHAR(25), country VARCHAR(25), img VARCHAR(50) );index.html
<script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery.watermarkinput.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".search").keyup(function() { var searchbox = $(this).val(); var dataString = 'searchword='+ searchbox; if(searchbox=='') { } else { $.ajax({ type: "POST", url: "search.jsp", data: dataString, cache: false, success: function(html) { $("#display").html(html).show(); } }); }return false; }); }); jQuery(function($){ $("#searchbox").Watermark("Search"); }); </script>Search.jsp: it displays results
<%@page import ="java.sql.*"%> <% if(request.getParameter("searchword")!=null) { String q=request.getParameter("searchword"); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:auto"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("select * from test_user_data where fname like '%"+q+"%' or lname like '%"+q+"%' "); while(rs.next()) { String fname=rs.getString(2); String lname=rs.getString(3); String img=rs.getString(5); String country=rs.getString(4); %> <div class="display_box" align="left"> <img src="user_img/<%=img%>" style="width:25px; float:left; margin-right:6px" /><%=fname%> <%=lname%><br/> <span style="font-size:9px; color:#999999"><%=country%></span></div> <% } con.close(); } catch(Exception e) { out.println(e); } } else { out.println("wrong"); } %>Css code: for simple and nice user interface
body { font-family:"Lucida Sans"; } * { margin:0px } #searchbox { width:250px; border:solid 1px #000; padding:3px; } #display { width:250px; display:none; float:right; margin-right:30px; border-left:solid 1px #dedede; border-right:solid 1px #dedede; border-bottom:solid 1px #dedede; overflow:hidden; } .display_box { padding:4px; border-top:solid 1px #dedede; font-size:12px; height:30px; } .display_box:hover { background:#3b5998; color:#FFFFFF; } #shade { background-color:#00CCFF; }
not able to download the attachment
ReplyDeleteneed query.js jquery.watermarkinput.js files content...
ReplyDeletejianbin1205
ReplyDeletecheap uggs
north face outlet online
coach outlet online
uggs outlet
snapback hats
true religion outlet,true religion jeans,true religion kids,true religion jeans sale,true religion jeans for men,true religion jacket,true religion sale
cheap oakley sunglasses
moncler coats
ugg boots on sale
cyber monday
kobe bryants shoes 2015
polo ralph lauren uk
moncler outlet
lululemon outlet
prada outlet
chanel handbags
ugg uk outlet
toms outlet
canada goose outlet
the north face jackets
new england patriots
chicago blackhawks
michael kors outlet sale
new york giants
air force one shoes
nike air max 90
ugg boots
air jordan 11 free shipping
michael kors handbags
nike trainers uk
air jordan shoes
kansas city chiefs
chicago bulls
Great Article
ReplyDeleteJavaScript Training in Chennai | JavaScript Course | Javascript Online Course | Angularjs Training in Chennai | Backbone.JS Training in Chennai | Bootstrap Training in Chennai | Node.js Training in Chennai
Great Article
Online Java Training | Java Training in Chennai | Java Training Institutes in Chennai | Java EE course | Java Course in Chennai | J2EE Training in Chennai | java j2ee training institutes in chennai | Java 360
This is a nice tip, and however I like your articles, thanks for give sharing this to all together.
ReplyDeleteRegards - Blot Tutorial Supporter
Very nice blog thanks for useful info with amazing content pay per click campaign
ReplyDeletehermes belt
ReplyDeletekd 12
longchamp handbags
off white
supreme new york
zx flux
jordan shoes
nmd
supreme outlet
hermes belt