Welcome Guest, Not a member yet? Register   Sign In


İ am fresh in Codeigniter. While i'm developing a facebook, i got a trouble.

In default controller derby->method index->view page:

<a href="nextcontroller/index/id/2">

When i clicked link,new page loads. In new view pagei i have another link. It's href part is empty. When i click it, jquery works.

$(function() {
var id = $(this).attr("id");
var name = $(this).attr("name");
var derby_team = $(this).attr("rev");
var dataString = 'id='+ id + '&derby;_team=' + derby_team ;
var parent = $(this);

$(this).fadeIn(200).html('<img src="img/dot.gif" align="absmiddle">');
type: "POST",
dataType: 'json',
url: "&lt;? echo base_url(); ?&gt;nextcontroller/votehome",
data: dataString,
cache: false,
success: function(html)
var vote_home = html.home;
var vote_away = 100 - vote_home;

My problem is: exampe.com/nextcontroller/method2 (I wanted that)

but i have that exampe.com/nextcontroller/index/id/2/nextcontroller/votehome

It adds previous url to new.

Probably because you are using relative URLs.

Try putting a slash in front of nextcontroller so it starts from the root of your site, like
<a href="/nextcontroller/method2">

firstly, thx for ur answer. i put slash front of nextcontroller, nothing changes. my problem: in jquery code, url line ( url: “&lt;? echo base_url(); ?&gt;/nextcontroller/votehome”,) links previous url (/nextcontroller/index/id/2)

Is your javascript in its own external js file, or is it contained in a php view file?

In jquery, try using using:
url: '/nextcontroller/votehome'
and not use PHP.

I forgot to put slash front of js file path. Thx for ur helping Smile

Theme © iAndrew 2016 - Forum software by © MyBB