gpt4 book ai didi

javascript - 如何将 jquery 数组值发送到 codeigniter Controller

转载 作者:行者123 更新时间:2023-12-02 17:55:12 25 4
gpt4 key购买 nike

我像这样通过 jQuery 传递一个数组

$.ajax({
url: "<?php echo base_url();?>index.php/autocomplete/test_search?added_ids[]="+ids,

.....

这是来自 chrome 的网络文本

..../autocomplete/test_search?added_ids[]=5190,3574,5369&term=s

我必须在 Controller 中捕获这个数组才能运行类似的查询

$selected = $this->input->get('added_ids');

$this->db->select('first_nm, last_nm , title');
$this->db->where_not_in('my_id', $selected);

但是对于数组中的第一个条目,它正在工作。下一个元素不会被排除在 where_not_in 部分中。你能帮我看看我哪里做错了吗?

最佳答案

使用-

ids.join(", ");

并将它们作为字符串传递

关于javascript - 如何将 jquery 数组值发送到 codeigniter Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21022129/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com