Dajaxice is not defined!!! please heelpppp!! :(

1,314 views
Skip to first unread message

doniyor

unread,
May 3, 2012, 2:01:14 PM5/3/12
to django...@googlegroups.com
Hi There, i need really your help!!!! 

i have been having this problem since 3 days.. it is really annoying me, i dont know why it is happening. The Problem is: 

i am trying to use dajax in my page and i followed all steps several times as given hier: http://dajaxproject.com/

but once i click on onclick="Dajaxice.home.randomize(Dajax.process), nothing is happening and i saw in console of firefox, there it says, "Dajaxice is not defined". but i included the {% dajaxice_js_import %} in the head, and even i linked the dajaxice.core.js file statically from my STATIC_URL. but it still says the same error. how can i go around this problem? is there any way of getting this work? 

when i link this {% dajaxice_js_import %} in the head, it says the error in console: "NetworkError: 500 INTERNAL SERVER ERROR-http://127.0.0.1:8000/dajaxice/dajaxice.core.js"  
when i delete this  {% dajaxice_js_import %} and serve statically from dajaxice.core.js file from STATIC_URL, it shows nothing in console, but once i click on onlick event, it says: Dajaxice is not defined

{% dajaxice_js_import %} this will look for dajaxice.core.js in dajaxice folder in site-packages, right? the file is there, why it cannot find the Dajaxice object? 

thanks for help in advance, 

Kurtis Mullins

unread,
May 3, 2012, 3:04:33 PM5/3/12
to django...@googlegroups.com
Hey,

Try taking a practically-empty HTML page that only includes that dajaxice.core.js file. Open up Firebug or some other Javascript console and type in "Dajaxice;" to see if you get the same error. This definitely sounds like a javascript problem since you're getting a "Dajaxice is not defined" error.

As far as the other problem (Missing file), read up the docs on serving Static Media with the Django runserver. You need to make sure dajax is included in your settings.py as an application. That's most likely a whole different problem from the "Dajaxice is not defined" issue.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/UGUTBZj9O_4J.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

doniyor

unread,
May 3, 2012, 4:05:55 PM5/3/12
to django...@googlegroups.com
hey, 
i did what you told me. i put the dajaxice.core.js in one nude html file, where i dont have other js files almost, then i opened the js console and i have done the input "Dajaxice", then it stil says there, 

ReferenceError: Dajaxice is not defined
               
Dajaxice

look, i hope, i am taking the up-to-date dajaxice.core.js file, since it is from the official dajaxproject site.. i have both dajaxice and dajax also in my settings.py. i took it out and tested, error message, so it means, it was right in settings.py. i am now thinking about using only jquery-ajax to get the work done. is it possible in this way? i can get the form values sent by jquery in my view without loading the page, this is actually what i wanted to do with dajax. is it a good go-around for the problem? 

thanks 


To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.

Kurtis

unread,
May 3, 2012, 4:34:56 PM5/3/12
to django...@googlegroups.com
Hmm, Yeah I'm not sure why their object isn't loading. I haven't used Dajaxice, myself.

Anyways, I posted an easy solution to performing JQuery AJAX POSTs in another thread. I'm hoping this link will work.  https://groups.google.com/forum/?hl=en&fromgroups#!topic/django-users/xBgm4p1COAA 

In the "success" function, there is a variable passed called "data". That will be the actual content sent from the server to the browser. You can apply similar methods to using $.get() as well. Just make sure you pass that {% csrf_token %} value when doing any AJAX Requests.

If you're still running into problems, feel free to post some code on what you're trying to achieve at dpaste.com (or somewhere similar).

Good luck!

Jirka Vejrazka

unread,
May 4, 2012, 2:23:19 AM5/4/12
to django...@googlegroups.com
> i am trying to use dajax in my page and i followed all steps several times
> as given hier: http://dajaxproject.com/
>
> but once i click on onclick="Dajaxice.home.randomize(Dajax.process), nothing
> is happening and i saw in console of firefox, there it says, "Dajaxice is
> not defined". but i included the {% dajaxice_js_import %} in the head, and
> even i linked the dajaxice.core.js file statically from my STATIC_URL. but
> it still says the same error. how can i go around this problem? is there any
> way of getting this work?

Hi, I did have this problem a few weeks ago. Did you doublecheck
your urls.py for Dajaxice-related links? What happens if you call
Dajaxice URL directly? (you should see requests for dajaxice.core.js
in your development server log).

Cheers

Jirka

doniyor

unread,
May 4, 2012, 4:10:25 AM5/4/12
to django...@googlegroups.com
Hey, thanks, i will try today and let you know. Actually, i did just the same things shown in installation guide. It cannot find it thru this 127.0.0.1:8000/dajaxice/dajaxice.core.js link.

What was the problem in your case?

Thanks many

doniyor

unread,
May 4, 2012, 10:54:40 AM5/4/12
to django...@googlegroups.com
hi 
here is the url of dajaxice in my settings.py. url(r'^%s/' % settings.DAJAXICE_MEDIA_PREFIX, include('dajaxice.urls')),

it is so as given in the docs. or should i configure something somewhere?  it seems that the problem is here.. 

doniyor

unread,
May 4, 2012, 11:06:12 AM5/4/12
to django...@googlegroups.com
if i call the dajaxice.core.js directly from address bar, it shows an error saying: ValueError at /dajaxice/dajaxice.core.js The view home.views.index didn't return an HttpResponse object.

so it means, i am serving dajaxice.core.js in a wrong way, right? 

Tom Evans

unread,
May 4, 2012, 11:48:19 AM5/4/12
to django...@googlegroups.com
On Fri, May 4, 2012 at 4:06 PM, doniyor <doniy...@googlemail.com> wrote:
> if i call the dajaxice.core.js directly from address bar, it shows an error
> saying: ValueError at /dajaxice/dajaxice.core.js The view home.views.index
> didn't return an HttpResponse object.
>
> so it means, i am serving dajaxice.core.js in a wrong way, right?
>

You may get better results asking about Dajax on the Dajax mailing list:

http://groups.google.com/group/dajaxproject

Cheers

Tom

Furbee

unread,
May 4, 2012, 1:36:38 PM5/4/12
to django...@googlegroups.com
If you are getting this error it is because your view is not returning an HttpResponse object. You need to wrap your return in an HttpResponse, or use the shortcut render_to_response() like:
    
    return render_to_response('template.htm', {'data': 'to_supply_to_template'}, context_instance=RequestContext(request))

or:
    
    return HttpResponse(my_json_object)

This may not solve your problem and get dajax working, but it may be a step in the right direction. I personally battled with some of the confining aspects of Dajax and ultimately went back to using jQuery straight up. This allowed me to write some client side trapping/displaying of errors. In my views I try the code and catch exceptions, then report to admins and return the error. My return callback javascript function is universal, it checks the JSON object returned for the err field which is 0 or 1. If it is 1, the error (stored in JSON['return_error']) is alerted to the user. If there was no error, it goes through with the callback that was intended (which was also stored in JSON['callback']). For me, this preserves the error reporting to admins and allows the user to see that there was an exception, instead of them thinking everything went through fine since it is input from their perspective correctly.

Cheers,

Furbee

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages