J
J
jaygen2020-06-30 08:32:56
JavaScript
jaygen, 2020-06-30 08:32:56

Ajax sending empty post request?

<input type="text" class="who" name="referal" placeholder="Поиск" value="">

$(document).ready(function() {                      
$('.who').change(function() {
        st=$(this).serialize();
        alert(st);
        $.ajax({
            type: 'get',
            url: '/admin/search',
            dаta: $(this).serialize(),
            success: function(data){
                alert(data);
                dat=jQuery.parseJSON(data);
                $(".search_result").html(dat); 
           }
       })
});});

What is the reason why ajax sends empty post request?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Tim, 2020-06-30
@jaygen

Your data field is not written in English

T
ThunderCat, 2020-06-30
@ThunderCat

What is the reason why ajax sends empty post request?
Everything is as always:
We look at the console for errors
We look at the network tab in the developer tools, find our ajax and see what is sent
We look at what is returned
To check the values ​​of variables in JavaScript, use console.log();
We think a lot...
Profit

A
Arman Hovhannisyan, 2020-07-01
@Armrisch

Use the oninput event instead of change, in my opinion this is exactly what you need

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question