H
H
Httdientee2021-03-31 20:28:58
AJAX
Httdientee, 2021-03-31 20:28:58

Can't compose correct JSON ajax?

$.ajax({
    type: "POST",
    url: "script.php",
    data: {
        search_table: offer: 'sdfsd', 
    },
    dataType: 'json'
});


I'm trying to do it, but it doesn't work, I need the result like this:
"filters":{"offer":"[\"creditplus\",\"givemoney\"]"


That is, the name of the filters key, then some other key is stored in it (in this example, offer), and the necessary data is already in the offer key. How can I make this type of json?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2021-03-31
@Httdientee

{ filters: { offer: ['creditplus', 'givemoney'] } }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question