PHP being commented out within JS [closed]

-2

The code is this:

   success: function (result) {
      var tbody = $('tbody');
      tbody.html('');

      $.each(result, function(k, value) {
        search += "<tr class='tagtr'>";
          search += "<td>" + value.description + "</td>";
          search += "<td>" + value.initial + "</td>";
          search += "<td>" + value.email + "</td>";
          search += "<td>" + value.url + "</td>";
          search += "<td id='table_status' class='text-center'><?= convertStatus(" + value.status + "); ?></td>";
          search += "<td class='text-center'>";
            search += "<button class='btn btn-red-dark' onclick='location=\"alter?q=" + value.id + "\"'><span class='glyphicon glyphicon-edit' aria-hidden='true'></span></button>";
          search += "</td>";
        search += "</tr>";
      });

      tbody.append(search);
   },
   error: function(result) {
      $('#alert').addClass('alert alert-danger').html().show('100');
   }
});

What can I do to stop commenting?

    
asked by anonymous 21.01.2016 / 15:28

1 answer

7

This will not work. PHP is processed by the Server, while the JavaScript code in this case is processed by the Client (Browser). You can create a looping in PHP to write JavaScript code, but you can not do the reverse (which is your case). Or you make an AJAX request to the server asking to run this function in PHP or you create a function in JavaScript to be called instead of trying to call PHP functions.

    
21.01.2016 / 15:38