M
M
Mr. Smith2018-03-21 18:02:19
JavaScript
Mr. Smith, 2018-03-21 18:02:19

How to properly process JSON post type?

How to process such code (what content should be in calc.php)

$.ajax({
        url: '/calc.php',
        type: 'POST',
        data: {
            'type': type, // Значение type будет например 50
            'control': control // Значение control будет например 20
        },
        dataType: "json",
        success: function (json) {
      prices=jQuery.parseJSON(json);

      $('#prices').html(formatRight(prices));

                          
        },
    });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Epifanov, 2018-03-21
@kacheleff

the data you send to the calc.php file will be available in an array $_POST
under the keys type and control

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question