Skip to main content

Posts

Showing posts with the label AJAX XMLHttpRequest object

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 Ajax error handling, show custom exception messages

Hello Guys, I am going to share the global error handling in the jQuery Ajax and trying to cover all the errors displays. The detail you can see in the example,  //jQuery global error handling Ajax. //#region NAMESPACE var demo = demo || {}; //#endregion //#region VARIABLES USED IN THIS JS var obj_hdrs = []; var obj = new Object(); //#endregion //#region GLOBAL CONTEXT demo.baseConst = { baseUrl: getBaseURL(), contentType: "application/json; charset=utf-8" , dataType: "json" , statusErrors : { 'M400' : "Server understood the request, but request content was invalid. [400]" , 'M401' : "Unauthorized access. [401]" , 'M403' : "Forbidden resource can not be accessed. [403]" , 'M404' : "Requested page not found. [404]" , 'M500' : "Internal server error. [500]" , 'M503' : "Service u...

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.     ...

AJAX - XMLHttpRequest Object

The XMLHttpRequest object is an API that is used to transferring data between a web browser and a web server using HTTP protocol and also provides the connection between a client and server. The object is provided by the browsers scripting languages looks like JavaScript, JScript, and other environments. It is also known as short name “ XHR ”. The concept behind the XMLHttpRequest object was originally created by Microsoft . The XMLHttpRequest property looks like, a)       onreadystatechange b)      responseText c)       responseXML d)      status e)       statusText f)        readyState : the readyState can be 0, 1, 2, 3 and 4.                              ...