I'm using jQuery to call a method of my "volunteer" CodeIgniter controller from a view called "edit" that takes a single parameter, "id"
The URI of the view is:
volunteer/edit/3
I make the call of my update()
method like so:
$.post('volunteer/update', function(data) {
console.log(data);
});
All the method does right now is echo a URI segment:
public function update(){
echo $this->uri->segment(2, 0);
}
What is want is a segment of the URI of the view where update()
is called (the "edit" view). Instead, I get a segment of the URI of update()
. How can I get a segment of the edit view's URI so that I can use it within the update()
method?