我从像这个
这样的html ul元素中获取了一些值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
})
}
现在我想获取php变量中的res值,我正在尝试这个但是它无法正常工作
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
})
}
请告诉我哪里出错了。