Skip to main content

Posts

Showing posts with the label ajax jquery example post

5 Best Ways To jQuery Validation in MVC 5 and Examples

How to validate a form in jQuery? The basic steps as, 1.      Download and link to jQuery. 2.      Download and link to thejQuery Validation plugin. /* Fire Required Valaidate */ $( function (){ $( "#frmEditUser" ).validate({ rules : { name : { required : true } }, messages : { name : "Required Field." } }); }); Here is what the validation code might look like if you have a form with your input fields FirstName and LastName as I motions in below example and you makes sure that the names of your input fields match your jQuery below example. Your form ID needs to match the ID called to validate in the first line of the above jQuery example i.e. #frmEditUser . This is for JQuery.Validate adding dynamic rules with messages with example //HTML CODE <form id= "frmEditUser" class= "color-text" > <input type= ...

Countdown Timer jQuery Free Online [How To]

In this post, I am going to share the “ Countdown Timer ” using jQuery online live demo and code sample as well. Stayed Informed - jQuery OOPs Concepts Please see the detail & live demo as following, < script src = "http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js" >< /script> < div id = "countdown" >< /div> < input type = "button" class = "button" value = "Start" id = "btnCountdownStart" /> < input type = "button" class = "button1" value = "Stop" id = "btnCountdownStop" /> < script type = "text/javascript" > var countdown = $( "#countdown" ).countdown360({ radius : 60 , seconds : 100 , label : [ "Sec" , "Seconds" ], fontColor : "#FFFFFF" , autostart : ! 1 , onComplete : function () { ...

2 Powerful Ways to Call Ajax Sync and Asyn Request [AJAX]

“ How do you use AJAX”?   “ How to call Synchronous and Asynchronous Requests”? The AJAX stands for “ Asynchronous JavaScript and XML ” and " AJAX " is a technique to creating interactive web applications and allows us to send and receive data asynchronously without refreshing the web page. more.. Example for calling “Synchronous” and “Asynchronous” Requests! //AJAX Synchronous and Asynchronous Requests. //#REGION NAMESPACE var demo = demo || {}; //#ENDREGION demo.ajax = demo.ajax || ( function () { var getBaseURL = function () { var currentBaseURL = location.protocol + "//" + location.hostname + (location.port && ":" + location.port) + "/" ; return currentBaseURL; }; var baseURL = getBaseURL(); var request_token; var ajaxAsyncCall = function (requestURL, typeGP, inputs, request_token) { $.ajax({ url : requestURL, ...

JQuery Mobile Introduction

JQuery Mobile is a touch-optimized web framework for creating mobile web apps and it is working on all popular smart-phones and tablets. Before you start learn jQuery mobile you should know following, ·          JQuery ·          CSS ·          HTML The uses of HTML, CSS and JavaScript solve these mobile related problems and it works for all standard mobile web browsers. Examples for Create a Basic Page Template in JQuery mobile as, <! DOCTYPE html > < html > < head > < meta name = "viewport" content = "width=device-width, initial-scale=1" > <!-- Include CSS URL --> < link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" > <!-- Include jQuery URL --> < script src = "https://code.jquery.com/jquery-1.11.3.min.js" ></ script > <!-- I...

jQuery click vs on events

The . click () events are only attach to fully loaded elements and can't use for dynamic added elements and utilize more memory and create event handler for each child. The .click() requires to event handler for all element which are attached. It is produce the overhead at time for DOM manipulations. The   .on( )  events are used for both dynamic added elements and its consume less memory then .click() events. It allows creating the event handler which elements are added dynamically ways. The .on() will work for current and future elements and it a replacement of the bind(), live() and delegate() methods. The Example over click() vs. on() in details as given below, For .click() events :- The HTML code, < ul   id ="click">      < li > List items </ li > </ ul > The JavaScript code, $( '#click li' ).click( function  () {     $( this ).parent().append($( '<li>New List i...

document ready vs. window load

What is main difference between the $(document).ready () and window.onload()? The main differences are the $(document).ready() event called when your HTML document is loaded and DOM is ready and it's don't wait for your content and images etc. fully loaded but  window.onload() (<body onload="func();">) event is  wait for your content and images etc. fully loaded. The $(document).ready() function is called only one time when your page is loading not for partial page rendering in that case you need to use pageLoad() function. Document Ready function:- We can call more than one document.ready() function in single page. The  document.ready()  function is called when  DOM  is not fully loaded that means rest of images, css or other 3rd party reference on page. It will not wait for the images, css or other 3rd party to get loaded. Body Onload function:- The body.onload() function, we can have only one body.onload...

JavaScript - AJAX Advantages and Disadvantages

Advantages:- 1.       Minimal Data Transfer 2.       An asynchronous call by XMLHttpRequest  and it is hold and wait process. 3.       Reduce the traffic travels between the client and the server and the response time is faster so increases performance and speed. 4.       Better responsive and interactivity and faster page renders and improved response times. 5.       Supports almost all modern browsers. 6.       Easy Navigation. 7.       Open source JavaScript libraries available for AJAX support like JQuery, etc. Disadvantages:- 1.       Insecure and increment the load on web server. 2.       All files are downloaded at client-side. 3.       Browser compatibility issues accrued. 4.     ...

jQuery AJAX - Asynchronous Request

The  Asynchronous  Request non-blocking the client  DOM / browser  until your operations is completed and only initiates the operations. It is a backgrounds process.   It is not  hold  and  waits  process and it is an asynchronous call and the asynchronous calls do not wait for a response to close the socket. The Asynchronous call are using when requests are not depend to each other request’s responses. The callback server must be available or the response will be failed. The operations (send, receive, and reply) will be synchronous or asynchronous. By default, the  $.ajax  request in  jQuery  is set to asynchronous and we can set ( async :  false ) for synchronous operations otherwise ( async :  true ). For Synchronous request click...     Example – AJAX Asynchronous Call //AJAX Synchronous and Asynchronous Requests. //#REGION NAMESPACE var demo = demo || {}; //...