Welcome Guest, Not a member yet? Register   Sign In
URL via javascript into CodeIgniter
#1

[eluser]Doncqueurs[/eluser]
Hi,

I ran into a little problem and couldn't really find an answer in this forum. It seems like there has been a closely related issue a year ago, but unfortunately that didn't help me to solve the problem.

I try to do the following. With this piece of javascript I would like to add url and sitename to my application.

Quote:java_script:location.href='http://localhost/index.php/bookmarks/add/'+encodeURIComponent(location.href)+'/'+encodeURIComponent(document.title)

(bookmarks is the controller and add the function within the controller)
(Of course java_script should be javascript but I am not allowed to use that word in this forum (or at least it gets automatically removed)

This results in the following URL:

Quote:http://localhost/index.php/bookmarks/add...0framework

On the receiving end I have this script:
Quote:<?php
class Bookmarks extends Controller {

function add($url, $name){ //
echo "URL: " . $url ."<br />";
echo "Name: " . $name;
}
}
?&gt;

If things were working fine this would display something like:
Quote:URL: http://www.codeigniter.com
Name: CodeIgniter

Instead I get:
Quote:Not Found

The requested URL /collaboration/index.php/bookmarks/add/http://www.codeigniter.com//CodeIgniter - Open source PHP web application framework was not found on this server.

Apache/1.3.33 Server at powerbook.local Port 80

Conclusion, it seems that CodeIgniter decodes the javascript urlencoded before it is told to do so. This results in requesting a URL that doesn't exist. Is there anybody who found a way to work around this?

Thanks, Jochem

PS. I tried to give full information I hope that I succeeded in it. In case you miss something please drop me a note. (I use a recent - last two weeks - download - last two weeks - of CodeIgniter).


Messages In This Thread
URL via javascript into CodeIgniter - by El Forum - 06-22-2007, 09:29 AM
URL via javascript into CodeIgniter - by El Forum - 06-22-2007, 05:49 PM
URL via javascript into CodeIgniter - by El Forum - 06-23-2007, 06:08 AM
URL via javascript into CodeIgniter - by El Forum - 06-23-2007, 12:26 PM
URL via javascript into CodeIgniter - by El Forum - 06-24-2007, 04:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB