I've come across a situation where I would appreciate some help with.
I have a controller called Site with a function as follows:
function getID(){
$id_data = $this->uri->segment(3);
$name = $this -> session -> userdata('name');
echo json_encode($this -> getID_model -> getID($id_data,$name ));
}
my url looks as follows
http://myapp.com/index.php?/site/user/96
when the link is opened the user is able to see his page only when the User function has ran my checks. This is why I can not remove or alter the User function since it needs to read the URI data and needs to be kept separate from my getID function
Now here is where my question comes in.
I need to make a call to the getID function in the Site controller and it needs the 3rd URI id number.
Below is my JQuery
var fullurl = $('#hiddenurl').val() + 'index.php?/site/getID/';
$.getJSON(fullurl, function(json) {
$.each(json, function(i,d) {
//do my output stuff.
});
$('#_description').append(output);
});
This won't work because the controller expects a 3rd URI segment.
Can someone tell me how I should add this segment in to the url? should I use some sort of JS parsing?
Thank you.