URI Problem with Ajax and jQuery |
[eluser]Devyn[/eluser]
Hi, Let's say I have 2 Controller (server and game). I show server list with controller 'server/index' which call multiple view. I check with jQuery every 3 seconds if both players are ready to play. Code: if(data == 1){`window`.`location`.replace('redirect_to_game/'+server_id);} Code: function redirect_to_game($server_id){ I mean above Code: redirect_to_game If i add parent controller like this, Code: if(data == 1){`window`.`location`.replace('server/redirect_to_game/'+server_id);}
[eluser]mah0001[/eluser]
Don't use relative paths. Try creating a js variable to hold the site url e.g. Code: [removed] and in your js, use the base_url to create full path. Code: if(data == 1){`window`.`location`.replace(CI.base_url+'/server/redirect_to_game/'+server_id);}
[eluser]pickupman[/eluser]
You could had a <base> tag to your header, and use jQuery to get the href attribute. Code: <base href="<?php site_url();?>" />
[eluser]Devyn[/eluser]
Thanks for your replies. @pickupman : I tried what you said but getting undefined value.
[eluser]Devyn[/eluser]
Well, my bad. It works now Thanks again for all of your replies! |
Welcome Guest, Not a member yet? Register Sign In |