Welcome Guest, Not a member yet? Register   Sign In
Weird CodeIgniter errors
#11

[eluser]CroNiX[/eluser]
Are these located in the root of your site, or in a subdirectory?
#12

[eluser]ibnclaudius[/eluser]
var/www/mysitefolder/codeigniter
#13

[eluser]CroNiX[/eluser]
That doesn't tell me if your directory is the site root or a subdirectory.

The reason I keep asking is because you keep using relative paths, like "../index.php/form/login", and when I, and others, try to get you to use base_url() it doesn't work for you. This is a problem. If you ever change servers, or move the structure of your site, it probably won't work with your relative paths and you will have a lot of fixing to do. Same if you ever to decide to remove index.php from the url. You would have to recode everything.

Ideally, you would set something like this in the <head> of your document:
Code:
<skript type="text/javascript">
// &lt;![CDATA[
var base_url = "&lt;?php echo base_url(); ?&gt;";  //use this for accessing assets, like images/js/etc
var site_url = "&lt;?php echo site_url(); ?&gt;";  //use this for accessing controllers (it will include index.php if you are using it)
// ]]>
</skript>
so you can then use it in your javascript.
Code:
site_url + 'form/login
which should come out to
http://yoursite.com/index.php/form/login
#14

[eluser]ibnclaudius[/eluser]
-var
--www
---mysite
----application
----assets
----system
----index.php

Is this?

...

I added your script to &lt;head&gt; and I'm calling the .post(), but is not working:
Code:
$.post(site_url + 'form/login', { data: $('#form-login').serialize() },

And what about the problem loading externals?



#15

[eluser]limit[/eluser]
What url does base_url() output when you echo it? Are you using views for your HTML?
#16

[eluser]ibnclaudius[/eluser]
Echo: http://localhost/mysite/

I load this view file:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
  &lt;meta http-equiv="content-type" content="text/html;charset=UTF-8" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url('assets/css'); ?&gt;/reset.css" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url('assets/css'); ?&gt;/misc.css" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url('assets/css'); ?&gt;/typography.css" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url('assets/css'); ?&gt;/forms.css" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url('assets/css'); ?&gt;/buttons.css" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url('assets/css'); ?&gt;&lt;?php if ($this-&gt;session-&gt;userdata('logged_in') === TRUE) : ?&gt;/user.css&lt;?php else : ?&gt;/site.css&lt;? endif; ?&gt;" /&gt;
  [removed]
   // &lt;![CDATA[
    var baseUrl = "&lt;?php echo base_url(); ?&gt;";
    var siteUrl = "&lt;?php echo site_url(); ?&gt;";
   // ]]>
  [removed]  
  [removed][removed]
  [removed][removed]
  [removed][removed]
  [removed][removed]
&lt;/head&gt;
&lt;body&gt;
  <div id="loading" class="loading"></div>
  &lt;?php $this->load->view('misc/header'); ?&gt;
   <div class="container">
    &lt;?php
    
     if ($this->session->userdata('logged_in') === TRUE)
     {
      $this->load->view('pages/user/' . $page);
     }
     else
     {
      $this->load->view('pages/site/' . $page);
     }
    
    ?&gt;
   </div>
  &lt;?php $this->load->view('misc/footer');?&gt;
&lt;/body&gt;
&lt;/html&gt;
#17

[eluser]ibnclaudius[/eluser]
I fixed the js problem.
Code:
var data = {
     'email' : email,
     'password' : password
   };

   $.post(siteUrl + '/form/login', data, function(callback){
    if(callback == 'TRUE')
    {
     //redirectionar o fdp
    }
    else
    {
     $("#input-email").addClass("error");
     $("#input-password").addClass("error");
    
     $('#errors-email').html("");
     $('#errors-password').html("<span class='error'>O e-mail e/ou a senha está incorreto. Tente novamente.</span>");
    }
   });
  
   loading.style.display = 'none';
   button.disabled = false;
  
   return false;

But the weird problem of loading the library persist...




Theme © iAndrew 2016 - Forum software by © MyBB