即時傳遞數組值到URL這樣 視圖代碼傳遞數組值的jquery AJAX URL
from_multiselect('functio[]',$function,'','id=function')
baseURL時/測試/角色?ID = 1,2,3
這是我的jQuery
$("#role > option").remove();
var id = $('#function').val();
alert(id);
var str=new Array();
alert(id);
$.ajax({
type: "POST",
url: "test/roles?id="+id,
success: function(roles)
{
alert(roles);
$.each(roles,function(id,roles)
{
var opt = $('<option />');
opt.val(id);
opt.text(roles);
$('#role').append(opt);
});
}
});
});
});
頁給出錯誤當我在URL傳遞數組值像不允許的關鍵字符。
預先感謝
你的PHP框架是「CodeIgniter」嗎? – Pupil
是鰓其codeigniter – balaji
然後plz試試我的答案,它可能會工作〜 – Pupil