I am not be able to save data retrieved from an AJAX request

Viewed 23

I want to get data using a GET request and save into data.

I have written below code but it is not working can any one give answer to save data in database

$(document).ready(function() {
  $.ajax({
    url: "https://www.zoya.in/wps/proxy/https/tsweb.titanprodlive.crown.in/wcs/resources/store/10151/storelocator/cities?supportedBrand=ZO",
    type: 'GET',
    dataType: "jsonp",
    async: false,
    crossDomain: true,
    contentType: 'application/json',
    secure: true,
    processData: false,
    // contentType: false,
    headers: {
      'Access-Control-Allow-Origin': '*',
      "Content-Length": "<calculated when request is sent>",
      "Host": "<calculated when request is sent>"
    },
    beforeSend: function(xhr) {
      xhr.setRequestHeader("Authorization", "Basic VGl0YW5fTXVsZTphZG1pbl90IXRhbl9tdWxl");
    },
    success: function(result) {
      // var res = $.parseJSON(result);
      console.log('city result:-  ');
    },
    error: function(xhr, status, error) {
      console.log(error);
      // alert(xhr.responseText);
    }
  })
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>

0 Answers
Related