JQuery AJAX

From HaFrWiki
Revision as of 16:50, 5 January 2022 by Hjmf (talk | contribs) (Created page with "{{TOCright}} == Introduction == The standard jQuery AJAX call looks like <pre> $.ajax( { url : './Index-be.php', type : 'POST', async :...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

The standard jQuery AJAX call looks like

$.ajax( {
   url            : './Index-be.php',
   type           : 'POST',
   async          : true,
   beforeSend  : function (request) {
            request.setRequestHeader(lbhguilanguage, userData.GuiLang);
   },
   data: {
       action      : '<?php echo ajaxXmlWeekDeath ?>',
       location    : 'COVID-19',
       regex       : JSON.stringify(regexp),
   },
   datatype       : 'xml'
}).done( function( textXML ) {
      // Handler for the success
}).fail( function( jqXHR, status, errorThrown) {
     // Handler for the failure
}).always( function( jqXHR, status ) {
     // Handler for the completion of the AJAX call for both done and fail
})

See also

top

Reference

top