Jquery POST with PHP does not query

0

I've never done a Jquery script that does the query with PHP via POST.

What I was able to do is this:

$('a.js-cd-panel-trigger').click(function(e) {
  e.preventDefault();
  var valor = $(this).attr('id');
  $.ajax({
    type: "POST",
    url: "php/fetch.php",
    data: {
      key: valor
    },
    dataType: "json",
    cache: false,
    success: function(result) {}
  })
});

I gave an alert in the 'id' (variable 'value') and it is bringing the id that I will query in PHP. If I give a preview element in Chrome and go to "Network", the functions I've already customized in other projects, I can see the return here.

But in this case, it is not returning, it seems that it is not communicating with the other side (of PHP).

If it works, I'll assign the values in some tags.

    
asked by anonymous 28.11.2018 / 19:38

0 answers