Category: jQuery

What is Software Testing Life Cycle (STLC)?

Software Testing Life Cycle (STLC) is a sequence of different activities performed during the software testing process.

Phases of STLC:

  1. Requirement Analysis:
    Requirement Analysis is the first step of Software Testing Life Cycle (STLC). In this phase quality assurance team understands the requirements like what is to be tested. If anything is missing or not understandable then quality assurance team meets with the stakeholders to better understand the detail knowledge of requirement.
  2. Test Planning:
    Test Planning is most efficient phase of software testing life cycle where all testing plans are defined. In this phase manager of the testing team calculates estimated effort and cost for the testing work. This phase gets started once the requirement gathering phase is completed.
  3. Test Case Development:
    The test case development phase gets started once the test planning phase is completed. In this phase testing team note down the detailed test cases. Testing team also prepare the required test data for the testing. When the test cases are prepared then they are reviewed by quality assurance team.
  4. Test Environment Setup:
    Test environment setup is the vital part of the STLC. Basically test environment decides the conditions on which software is tested. This is independent activity and can be started along with test case development. In this process the testing team is not involved. either the developer or the customer creates the testing environment.
  5. Test Execution:
    After the test case development and test environment setup test execution phase gets started. In this phase testing team start executing test cases based on prepared test cases in the earlier step.
  6. Test Closure:
    This is the last stage of STLC in which the process of testing is analyzed.

jQuery.ajax() Method

jQuery.ajax() method performs asynchronous http request and gets the data from the server. it allows you to send asynchronous http requests to submit or retrieve data from the server without reloading the whole page.
it can be used to send http GET, POST, PUT, DELETE etc. request. It can retrieve any type of response from the server.

Syntax: jQuery.ajax(url,[options])

Use option parameter to customize ajax request as per your need. All available options for configuring Ajax request can be listed below.

  • accepts
  • async
  • beforeSend
  • cache
  • complete
  • contentType
  • crossDomain
  • data
  • dataType
  • error
  • global
  • headers
  • ifModified
  • isLocal
  • jsonp
  • jsonpCallback
  • mimeType
  • password
  • processData
  • statusCode
  • success
  • timeout
  • type
  • url
  • username
  • xhr
  • xhrFields

What is the difference between jQuery.get() and jQuery.ajax()?

jQuery.ajax() is the all-encompassing Ajax request method provided by jQuery. It allows for the creation of highly-customized Ajax requests, with options for how long to wait for a response, how to handle a failure, whether the request is blocking (synchronous) or non-blocking (asynchronous), what format to request for the response, and many more options.

jQuery.get() is a shortcut method that uses jQuery.ajax() under the hood, to create an Ajax request that is typical for simple retrieval of information. Other pre-built Ajax requests are provided by jQuery, such as jQuery.post(), jQuery.getScript(), and jQuery.getJSON().

Show welcome message only once per day

If you want to display a welcome message or alert box then you have to add the following JavaScript in your file.

function setCookie(key, value) {
            var expires = new Date();
            expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000));
            document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
        }

function getCookie(key) {
           var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
           return keyValue ? keyValue[2] : null;
        }
if(getCookie('pop')==null)
{
	setCookie('pop',1);
	alert("WELCOME");
}

That’s it. In this code alert box shows only once per day.

Have any doubt, then comment here!