$ _POST一次又一次打印相同的值

时间:2018-08-01 09:48:05

标签: php jquery ajax

我可以使用post方法将多个值传递给ajax页,但是当我在ajax页中打印值时,它将一次又一次地打印值。我被困住了,不知道发生了什么。

(batch_size, width, height, channels, frames)

输出:

<script>
//sending values through Jquery
var department1;
var location1;
var sub_department1;
    $(function(){
        $('.item_filter').click(function(){
            department1 = multiple_values('department');
            location1  = multiple_values('location');
            alert(location1);
            sub_department1  = multiple_values('sub_department');
            $.ajax({
                url:"search-jobs.php",
                type:'post',
                data:{department12:department1,location12:location1,sub_department12:sub_department1},
                success:function(result){alert(result);
                    $('.corporate-jobs').html(result);
                },
            });
        });
    });
function multiple_values(inputclass){
    var val = new Array();
    $("."+inputclass+":checked").each(function() {
        val.push($(this).val());
    });
    return val;
}
</script>


<?php
 //printing values in Ajax page    
//Fetch data from corporate page
$locations = $_POST['location12'];    
print_r($locations);die();    
?>

1 个答案:

答案 0 :(得分:0)

λ> runConduit $ Text.XML.Stream.Parse.parseLBS def  "<foo>bar</foo><person age=\"25\">Michael</person><person age=\"2\">Eliezer</person>" .| many_ (choose [takeTree "person" ignoreAttrs, ignoreAnyTreeContent]) .| manyYield parsePerson .| Data.Conduit.List.consume 
[Person 25 "Michael",Person 2 "Eliezer"]

尝试此代码...