There is data in the request at the name of url '/r/rr-autocomplete/?q=string':
{"results": [{"id": "371", "text": "strstr", "selected_text": "strstr"}], "pagination": {"more": false}}
I want with jQuery to query the data and write the value of the id to the variable. My js code
$.get('r/rr-autocomplete/?q=string', function (data) {
console.log(data.results)
})
In the console, I get the desired array, but I do not know how to write the id value.
{
"id": "371",
"text": "strstr",
"selected_text": "strstr"
}
I will be glad for any help.