skip to Main Content

Jquery ajax – If an AJAX REST API succeeds or fails, how do I access the request headers within the success or error callbacks?

For example, I have: $.ajax({ type: 'POST', url: 'https://jsonplaceholder.typicode.com/todos', data: { name: 'random name' }, headers: { 'x-my-custom-header': 'XYZ' }, success: function(successResp) { console.log(successResp); }, error: function(errorResp){ console.log(errorResp); } }); How can I access 'x-my-custom-header' from the request header within success…

VIEW QUESTION

Jquery ajax – Reset Form after captcha validation in ajax jquery

<?php session_start(); if($_POST["captcha"]==$_SESSION["captcha_code"]){ $email_to = "[email protected]"; $email_subject = "Mail from contact form"; $name = $_POST['name']; // required $topic = $_POST['topic']; // required $email_from = $_POST['email']; // required $telephone = $_POST['phone']; // not required $message = $_POST['message']; // required $email_message =…

VIEW QUESTION
Back To Top
Search