title: Dajaxice. Cannot call method '...' of undefined. Again
body: <p>I'm stuck in trying to create a simplest application with dajaxice.
  I'n read all topics about this problem here and not only here, rewrite all code many times, but still do not see what the problem is.
  the most interesting that, these examples are working (almost all):
  <a href="https://github.com/jorgebastida/django-dajaxice/downloads" rel="noreferrer">https://github.com/jorgebastida/django-dajaxice/downloads</a>  dajaxice-examples.tar.gz</p>
  
  <p>But in my project i have this:</p>
  
  <pre><code>Uncaught TypeError: Cannot call method 'sayhello' of undefined 
  </code></pre>
  
  <p>my tools:</p>
  
  <ul>
  <li>Windows 7 64</li>
  <li>python-2.7.3</li>
  <li>Django-1.4.2</li>
  <li>django-dajaxice-0.2</li>
  </ul>
  
  <p>project structure:</p>
  
  <pre><code>BlocalProject/
      templates/
          template_1.html
      manage.py
      BlocalProject/
          ajapp/
              __init__.py
              ajview.py
          __init__.py
          settings.py
          urls.py
          views.py
          wsgi.py
  </code></pre>
  
  <p>urls.py:</p>
  
  <pre><code>from django.conf.urls.defaults import *
  import settings
  from dajaxice.core import dajaxice_autodiscover
  dajaxice_autodiscover()
  
  
  urlpatterns = patterns('',
      (r'^%s/' % (settings.DAJAXICE_MEDIA_PREFIX), include('dajaxice.urls')),
      (r'^$', 'BlocalProject.views.start_page'),
  )
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>from django.shortcuts import render
  
  def start_page(request):
      return render(request,'template_1.html')
  </code></pre>
  
  <p>ajapp.py:</p>
  
  <pre><code>from django.utils import simplejson
  from dajaxice.core import dajaxice_functions
  
  
  def sayhello(request):
      return simplejson.dumps({'message': 'Trololo!'})
  
  dajaxice_functions.register(sayhello)
  </code></pre>
  
  <p>template_1.html:</p>
  
  <pre><code>{% load dajaxice_templatetags %}
  &lt;html&gt;
    {% dajaxice_js_import %}
    &lt;script&gt;
      function alertMessage(data){
        alert(data.message);
        return false;
      }
    &lt;/script&gt;
  
    &lt;body&gt;
      Some text
      &lt;input type="button" value="Get!" onclick="Dajaxice.ajapp.sayhello(alertMessage);" /&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>settings.py:</p>
  
  <pre><code># Django settings for BlocalProject project.
  
  DEBUG = True
  TEMPLATE_DEBUG = DEBUG
  
  ADMINS = (
      # ('Your Name', 'your_email@example.com'),
  )
  
  MANAGERS = ADMINS
  
  DATABASE_ENGINE = ''           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
  DATABASE_NAME = ''             # Or path to database file if using sqlite3.
  DATABASE_USER = ''             # Not used with sqlite3.
  DATABASE_PASSWORD = ''         # Not used with sqlite3.
  DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
  DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
  
  # Local time zone for this installation. Choices can be found here:
  # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  # although not all choices may be available on all operating systems.
  # In a Windows environment this must be set to your system time zone.
  
  TIME_ZONE = 'America/Chicago'
  
  # Language code for this installation. All choices can be found here:
  # http://www.i18nguy.com/unicode/language-identifiers.html
  LANGUAGE_CODE = 'en-us'
  
  SITE_ID = 1
  
  # If you set this to False, Django will make some optimizations so as not
  # to load the internationalization machinery.
  USE_I18N = True
  
  # Absolute filesystem path to the directory that will hold user-uploaded files.
  # Example: "/home/media/media.lawrence.com/media/"
  MEDIA_ROOT = ''
  
  # URL that handles the media served from MEDIA_ROOT. Make sure to use a
  # trailing slash.
  # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
  MEDIA_URL = ''
  
  # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
  # trailing slash.
  # Examples: "http://foo.com/media/", "/media/".
  ADMIN_MEDIA_PREFIX = '/media/'
  
  # URL prefix for static files.
  # Example: "http://media.lawrence.com/static/"
  STATIC_URL = '/'
  
  
  # Make this unique, and don't share it with anybody.
  SECRET_KEY = ')er9!%4v0=nmxd#2=j1*tlktmidq8aam2y)-%fjf6%^xp*5r)c'
  
  # List of callables that know how to import templates from various sources.
  TEMPLATE_LOADERS = (
      'django.template.loaders.filesystem.Loader',
      'django.template.loaders.app_directories.Loader',
      #'django.template.loaders.eggs.load_template_source',
  )
  
  MIDDLEWARE_CLASSES = (
      'django.middleware.common.CommonMiddleware',
      'django.contrib.sessions.middleware.SessionMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
  )
  
  ROOT_URLCONF = 'BlocalProject.urls'
  
  # Python dotted path to the WSGI application used by Django's runserver.
  #WSGI_APPLICATION = 'BlocalProject.wsgi.application'
  
  TEMPLATE_DIRS = (
      'D:/_/Site_test/Djpr/BlocalProject/templates',
      # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
      # Always use forward slashes, even on Windows.
      # Don't forget to use absolute paths, not relative paths.
  )
  
  TEMPLATE_CONTEXT_PROCESSORS = ("django.contrib.auth.context_processors.auth",
                                 "django.core.context_processors.debug",
                                 "django.core.context_processors.i18n",
                                 "django.core.context_processors.media",
                                 "django.core.context_processors.static",
                                 "django.core.context_processors.request",
                                 "django.contrib.messages.context_processors.messages",)
  
  INSTALLED_APPS = (
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.sites',
      'dajaxice',
      'BlocalProject.ajapp',  
  )
  
  DAJAXICE_MEDIA_PREFIX = "dajaxice"
  DAJAXICE_DEBUG = True
  DAJAXICE_JS_DOCSTRINGS = True
  #DAJAXICE_NOTIFY_EXCEPTIONS = True
  
  import logging
  logging.basicConfig(level=logging.DEBUG)
  </code></pre>