Closed akshayutture closed 10 years ago
small code
long bit of code
with indents
No error message is being shown. The dajaxice part of the javascript just isnt working . I tried this tutorial but on clicking the button nothing happens. There is no error message on the browser or the terminal. . http://django-dajaxice.readthedocs.org/en/latest/quickstart.html
In chrome check the "netowork" tab. Does the request go to the server ? It'll show something like
apps.users.get_info/
/dajaxice
on the left column. Where the names will be changed depending on your function.
Try running the code through Terminal Dajaxice.apps.portals.events.args_example(function(response) { console.log(response); }, {'text' : 'kdrgnkrs' })
I just saw your events2.html, there is no button nor is there any javascript code... Did you read the examples properly ?
On Sat, Jun 28, 2014 at 7:56 PM, akshayutture notifications@github.com wrote:
No error message is being shown. The dajaxice part of the javascript just isnt working . I tried this tutorial but on clicking the button nothing happens. There is no error message on the browser or the terminal. . http://django-dajaxice.readthedocs.org/en/latest/quickstart.html
Reply to this email directly or view it on GitHub https://github.com/The-WebOps-Club/fest-api/issues/101#issuecomment-47428790 .
Sorry I printed the wrong html here. The correct one is given below.
HTML {% extends 'base/base.html' %} {% load check_access %}
{% block content %}
{% load dajaxice_templatetags %}
{% dajaxice_js_import %} {% csrf_token %}
<input type="button" onclick="Dajaxice.apps.portals.events.sayhello(my_callback)" value="Get
message from server!"> 555nhjh5
<script>
function my_callback(data){
alert(data.message);
}
</script>
{% endblock %}
AJAX.PY
from django.utils import simplejson from dajaxice.decorators import dajaxice_register
@dajaxice_register def sayhello(request): return simplejson.dumps({'message':'Hello World'})
I still do not see any javascript nor buttons mate :/
On Sun, Jun 29, 2014 at 1:19 PM, akshayutture notifications@github.com wrote:
Sorry I printed the wrong html here. The correct one is given below I tried a dozen variations
HTML
{% extends 'base/base.html' %} {% load check_access %}
{% block content %}
{% load dajaxice_templatetags %}
{% dajaxice_js_import %} {% csrf_token %} 555nhjh5
{% endblock %}
AJAX.PY
from django.utils import simplejson from dajaxice.decorators import dajaxice_register
@dajaxice_register def sayhello(request): return simplejson.dumps({'message':'Hello World'})
Reply to this email directly or view it on GitHub https://github.com/The-WebOps-Club/fest-api/issues/101#issuecomment-47448137 .
I think the javascript part isnt getting printed here. I'll send you a mail
No, dont do that. Post your code with backticks ... as i had mentioned before. If you dont tell github ur putting code, obviously github will get confused no
On Sun, Jun 29, 2014 at 1:24 PM, akshayutture notifications@github.com wrote:
I think the javascript part isnt getting printed here. I'll send you a mail
Reply to this email directly or view it on GitHub https://github.com/The-WebOps-Club/fest-api/issues/101#issuecomment-47448207 .
Okay. Edited the above comment to include the html and js
Try runnibg what you wrote in onclick in chrome debuggers console tab On Jun 29, 2014 1:33 PM, "akshayutture" notifications@github.com wrote:
Okay. Edited the above comment to include the html and js
Reply to this email directly or view it on GitHub https://github.com/The-WebOps-Club/fest-api/issues/101#issuecomment-47448330 .
Resource interpreted as Script but transferred with MIME type application/octet-stream: "http://localhost:8000/static/dajaxice/dajaxice.core.js". (index):699 GET http://graph.facebook.com/Fest%20API/picture?height=60&width=60 404 (Not Found) jquery-1.11.0.js:8231 3 Uncaught TypeError: Cannot read property 'sayhello' of undefined
Try writing dajaxice.apps
and dajaxice.apps.portals
and check if they
exist.
If they don't, restart your server and refresh. If there's an error in
dajaxice it'll come only for the first time you open a page after
restarting server
On Jun 29, 2014 1:37 PM, "akshayutture" notifications@github.com wrote:
Resource interpreted as Script but transferred with MIME type application/octet-stream: " http://localhost:8000/static/dajaxice/dajaxice.core.js". (index):699 GET http://graph.facebook.com/Fest%20API/picture?height=60&width=60 404 (Not Found) jquery-1.11.0.js:8231 3 Uncaught TypeError: Cannot read property 'sayhello' of undefined
Reply to this email directly or view it on GitHub https://github.com/The-WebOps-Club/fest-api/issues/101#issuecomment-47448386 .
In the console tab of chromes debugger (ctrl shift j) On Jun 29, 2014 1:45 PM, "akshayutture" notifications@github.com wrote:
where do i write dajaxice.apps and dajaxice.appsanddajaxice.apps.portals
Reply to this email directly or view it on GitHub https://github.com/The-WebOps-Club/fest-api/issues/101#issuecomment-47448506 .
dajaxice.apps ReferenceError: dajaxice is not defined
its cappital D ... i was on phone so it was difficult to type
On Sun, Jun 29, 2014 at 1:48 PM, akshayutture notifications@github.com wrote:
dajaxice.apps ReferenceError: dajaxice is not defined
Reply to this email directly or view it on GitHub https://github.com/The-WebOps-Club/fest-api/issues/101#issuecomment-47448561 .
I understood Dajaxice but the following example is not running on fest-api. Below are the changes I made to fest-api to try making it work. . The page opens. Other javascript functions work, but the one with dajaxice does not. (Online troubleshooting fr this problem has not helped)
def portal_main2( request ): return render_to_response('portals/events/events2.html', locals(), context_instance = global_context(request))
from django.utils import simplejson from dajaxice.decorators import dajaxice_register
@dajaxice_register def args_example(request, text): return simplejson.dumps({'message':'Your message is %s!' % text})
{% extends 'base/base.html' %} {% load check_access %}
{% block content %}
{% load dajaxice_templatetags %}
{% dajaxice_js_import %} {% csrf_token %} sssa
{% endblock %}