vendredi 20 mars 2020

How to change html id into variable Laravel

I have this html line of code <span id="mycount"></span> which displays live data(number) from database so let's say it displays 5 from database. What I want to do is to use if statement like this@if(5 > 0). So is it possible to change maybe the id="mycount" into a variable or any other way so that I can use if statement?

Html

<span id="mycount"></span>  //This displays 5

I want to have something like this

 @if(5 >0)
 //display data
 @else
 @endif

Javascript

function getCount() {
$.ajax({
type: "GET",
url: '',
success: function(data) {
    $('#mycount').html(data);
   setTimeout(getCount, 1000);
}
});

}
getCount();


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire