I am getting some values from html ul elements like this
function myFunction() {
var values =[];
$('#sortable2').each(function(){ // id of ul
var li = $(this).find('li')//get each li in ul
var res = li.text().split("::");
console.log(res)//get text of each li
})
}
Now I want to get the res values in php variables I am trying this but it is not working
function myFunction() {
var values =[];
$('#sortable2').each(function(){ // id of ul
var li = $(this).find('li')//get each li in ul
var res = li.text().split("::");
<?php
$arr = res;
echo "alert('$arr')";
?>
console.log(res) //get text of each li
})
}
Please tell me where I am going wrong.