Welcome Guest, Not a member yet? Register   Sign In
Opening a new page w/ dynamic data
#10

It's all because CI expects URL's to have at least 2 segments: controller and method. If the second segment is omitted, the controller will execute the index method by default.
Code:
c_tunesheet/edit   //means: open then c_tunesheet controller and find the edit method inside it
c_tunesheet/edit/44  //means: find the edit method (like the first example) and pass the value 44 to the first parameter
c_tunesheet  //means: open the c_tunesheet controller and find the index method

The command
Code:
window.open("<?= site_url('c_tunesheet/');?>"+tuneID,'_blank');
will assume that tuneID is the name of the method!

This should work:
Code:
window.open("<?= site_url('c_tunesheet/index');?>"+tuneID,'_blank');

But then, your index method should look like this:
PHP Code:
public function index($tuneID NULL) {
 
 //your code here

to pass the parameter!
= NULL means that the variable $tuneID will be set to NULL if no parameter is passed.
Reply


Messages In This Thread
Opening a new page w/ dynamic data - by codeguy - 03-03-2017, 10:06 AM
RE: Opening a new page w/ dynamic data - by Wouter60 - 03-05-2017, 11:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB