When i'm trying to send data(url) to API with ajax request, PHP CI controller not considering all parameters in $_GET. it just accepting up to &.
Is there any error in passing parameters? Please help. I tried passing direct url and encodeURI.
JQuery code
$.ajax({
type: "GET",
url: "<?= ROOT?>welcome/ajaxapiget",
data: encodeURI(http://localhost/webapi/list?categories[]=3&categories[]=12),
cache: false,
success: function (data) {
alert(data);
}
});
PHP
function ajaxapiget() {
$url = $_GET;`//its getting url as http://localhost/webapi/list?categories[]=3`
$curl = curl_init();
........
........
response $response;
}
also tried like this
$.ajax({
type: "GET",
url: "<?= ROOT?>welcome/ajaxapiget",
data: 'url=http://localhost/webapi/list?categories[]=3&categories[]=12)',
cache: false,
success: function (data) {
alert(data);
}
});
PHP
function ajaxapiget() {
$url = $_GET(url);`//its getting url as http://localhost/webapi/list?categories[]=3`
$curl = curl_init();
........
........
response $response;
}
When i alert
before sending request
url=http://localhost/webapi/courselist?categories[]=15&categories[]=17
response from controller (alert at ajax success)
$url = $_GET('url');
echo $url
alert response
http://localhost/webapi/courselist?categories[]=15