如何将jquery变量值转换为php变量

时间:2016-04-04 10:19:47

标签: php jquery

我从像这个

这样的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
    })
}

请告诉我哪里出错了。

0 个答案:

没有答案