B
B
Black_Fire2021-09-29 03:54:57
AJAX
Black_Fire, 2021-09-29 03:54:57

How to store the data received in the response by variables?

It is necessary to get data from json (object) using an Ajax request on jquery and store the values ​​of some fields from it by variables. These variables should be used later. Json is located at . This is a copy of it with some fields marked for preservation. If there is a solution, then by analogy I will save the rest of the data.

{
    "state": "ok",
    "data": {
        "product_id": "806",
        "first_period_everyday_percent": "0,01",
        "first_period_year_percent": "3,6",
        "second_period_everyday_percent": "1,9",
        "second_period_year_percent": "684",
        "first_period_day_count": "21",
        "min_sum": "500",  // в переменную minSum
        "max_sum": "5000",  // в переменную maxSum
        "default_sum": "5000",
        "sum_step": "100",
        "min_term": "5",  // в переменную maxTerm
        "max_term": "21", // в переменную minTerm
        "default_term": "21",
        "term_step": 1,
        "repeat_question": false
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nadim Zakirov, 2021-09-29
@zkrvndm

Open your browser console right now and type:

response = await $.ajax('https://kachay.com.ua/calculation_info.php');

The response.data variable will contain all the parameters you need, you can access them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question