Jump to content

abdulwasay

New Members
  • Posts

    2
  • Joined

  • Last visited

abdulwasay's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. //Index.php <ul id=""> <div id="carlist"> </div> </ul> //script <script> $(document).ready(function () { var listtt = setInterval(function () { $.ajax({ url: "list.php", success: function (html) { let listtt = html; if (listtt) { document.getElementById("carlist").innerHTML = listtt; } } }); } , 5000) $('.a').click(function () { carId = $(this).attr("abc"); alert (carId); }); });</script> //list.php $query = mysqli_query($con, "SELECT * FROM tblproduct"); while($data = mysqli_fetch_assoc($query)) { print '<li class="get_car" car_id="'. $data['id'].'"><span>'.$data['name'].'</span><button class="a" abc="'. $data['id'].'" type="button">hello</button></li>'; }
  2. I want to get the attribute of li. but the issue is this that i am loading my page using ajax and after every 10 sec the list was updating. ajax was disabling my li i am not be able to click on any li. so i want to know how get the attribute of li.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.