Tag: ajax

JSP Servlet with AJAX Example

J2EE
JSP Servlet with AJAX Example Ajax is a great feature implemented almost in all the websites in some way. It gives really a very good user interface, since things are loading/populating without refresh. It is commonly used in username availability checking, register/login page db level/business level validations etc. We are going to use Ajax with JSP and servlet to calculate the EMI payable amount by giving amount, month and interest rate in single screen(without refreshing). Requirements: 1. Include jQuery library (since we used $.get for ajax response) 2. Include Bootstrap libraries (for responsiveness) Including jQuery and Bootstrap libraries in header section: [html] <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <script src="js/jquery-...
Alexa website rank script using PHP, jQuery, Bootstrap and Ajax

Alexa website rank script using PHP, jQuery, Bootstrap and Ajax

Jquery, Php, Readymade Scripts
Alexa website rank script using PHP, jQuery, Bootstrap and Ajax: Alexa is a very popular and trusted site to give the rank for all the websites. It is a successful website ranking product of amazon. They are having many developer API to display every websites country and world rank. You can make use of this API to display any websites rank in your websites/mobile apps. Today we are sharing here the readymade Alexa website rank script using PHP, jQuery, Bootstrap and Ajax. We made it as responsive to help all type of users by supporting all devices. If you are planning to start alexa website rank site or planning to create a mobile app to display the alexa website rank then this script can help you. Script can be added to your existing websites/apps for website ranks.
PNR Status Script using PHP, jQuery and Ajax

PNR Status Script using PHP, jQuery and Ajax

Articles, Jquery, Php, Readymade Scripts
PNR Status Script: Update: Demo may not work as expected, because the testing key provided by the "railwayapi.com" got expired.   You can create your own key and substitute that in the script and run to get the expected results / PNR status.   Are you planning to develop any PNR alert, status website or any mobile apps ? (or) planning to integrate the PNR status script to your existing website. ?   We have provided here how to get the PNR status programmatically using third party API's and provided the complete source code of the PNR Status Script. we have developed PNR status script using PHP, jQuery and Ajax and also, JSON and Bootstrap 3.     PNR Status Free API's: 1. eRail PNR API 2. Rail PNR API 3. Railway API 4. Mashap
JSON in Servlet with Ajax call

JSON in Servlet with Ajax call

J2EE
JSON in Servlet with Ajax call: JSON is a amazing alternate for XML to pass/transfer the informations. It is required to know how to handle JSON in servlet. In servlet it can be handled like this, [plain] request.setCharacterEncoding("utf8"); response.setContentType("application/json"); // json is the JSON object. response.getWriter().print(json); [/plain] But if you want to call your servlet through ajax, then we should handle the JSON response in JS also to display JSON in jsp page, else only object object will be printed in JSP page. Ajax JS changes to display JSON: [plain] // for json [if responseText is JSON ] $('#printJSON').text(JSON.stringify(responseText)); // for string [if responseText is String ] $('#printJSON').tex...

Dynamically add/remove jsf components example

Java Server Faces
Program:   dynamic.xhtml: [html] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"> <h:head> </h:head> <h:body> <h:form> <h:dataTable value="#{dynBean.dynList}" var="myListElement"> <h:column> <h:panelGrid> <h:outputText value="www.ngdeveloper.com"></h:outputText> </h:panelGrid> </h:column> </h:dataTable> &l...

Session Validation in Ajax

J2EE, Javascript
Session validation in servlet: Usually if it is a servlet we can simply check if(session != null ){ // Business code }else{ // Redirection code }   Session validation in ajax: If you call the servlet from ajax then the above steps won't work, since ajax gets everything as response, so the code which you have written in the else block (Redirection code) will also be sent as response, so expected redirection will not happen. So what can we do ? We have to send the response from servlet to ajax (eg: json ) for both the cases (session valid and session invalid). if(session !=null) { json.put("session_status",true) }else{ json.put("session_status",false) } out.println(json.toString()); we have to check the session_status in ajax whether it is true or false like ...

jQuery Bubble Popup onclick event sample program

Jquery
Step 1: Javadomain-jquery-bubble-popup.html [html]<!DOCTYPE HTML> <html> <head> <title>jQuery Bubble Popup - Javadomain</title> <link href="jquery-bubble-popup-v3.css" rel="stylesheet" type="text/css" /> <script src="jquery-1.7.2.min.js" type="text/javascript"></script> <script src="jquery-bubble-popup-v3.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $('.mButton').click(function() { var button_id = this.id.replace('link', 'button'); var button = $('#' + button_id); if ($('.mButton').HasBubblePopup()) { alert('Bubble popup already opened'); return false;

Ajax Calling in jQuery

Jquery
Step 1:  Callingajax.html <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Javadomain example</title> </head> <script src="scripts/jquery-1.9.0.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $('.button').click(function() { $.ajax({ url : "sample.html", type : "GET", error : function() { alert("failure"); }, success : function(data) { $('#cm').html(data); // to display the sample.html file content. } }); }); }); </script> <body> <h1 align="cen

Ajax tutorials with examples

Java
Ajax (Asynchronous javascript and xml) Ajax is used to refresh the partial page instead of refreshing the whole page. Ajax is used to achieve the more interaction. 3 pillers 1. javascript 2. xml 3. xhr object(XmlHttpRequest object) Ajax process: 1. Calling ajax function (its like normal javascript calling) 2. Creating xhr object.(based on the browser types) xhr object is created based on browsers, If IE browser then xhr object shoule be created using ACTIVEX method.And for other browsers it should be created by native method. 3. xhrobject.open(GET/POST, url,TRUE(asynchronous)) - to initialize the connection. 4. xhrobject.send(null) - to send the request to server (null for GET Method and String values for POST Method). 5. do the business logics and call th