On 19 Jan 2014 00:18, "François Schiettecatte" <fschietteca...@gmail.com>
wrote:
>
> Hi
>
> IANA says the JSON mime type be application/json, so you might want to
use that.
>
> application/javascript should be for javascript.

Yes thats true. My bad.

>
>
> François
>
> On Jan 18, 2014, at 12:05 PM, Babatunde Akinyanmi <tundeba...@gmail.com>
wrote:
>
> > https://docs.djangoproject.com/en/1.6/ref/request-response/#usage
> >
> > Actually, Google is your friend.
> >
> > On 18 Jan 2014 19:48, "Igor Korot" <ikoro...@gmail.com> wrote:
> > Hi, Babatunde,
> >
> > On Sat, Jan 18, 2014 at 8:32 AM, Babatunde Akinyanmi
> > <tundeba...@gmail.com> wrote:
> > > Thats probably because you are returning the json as a context in a
response
> > > with the default "text/html" mime type. Your response should have
mime type
> > > as " application/javascript".
> > > Your json data should be in the response
> >
> > How do I do that? Could you give me some code, please?
> > Or at least point to the docs...
> >
> > Thank you.
> >
> > >
> > > On 18 Jan 2014 09:16, "Igor Korot" <ikoro...@gmail.com> wrote:
> > >
> > > Hi, guys,
> > >
> > > On Sat, Jan 18, 2014 at 12:02 AM, Babatunde Akinyanmi
> > > <tundeba...@gmail.com> wrote:
> > >>
> > >> On 18 Jan 2014 08:32, "Mario Gudelj" <mario.gud...@gmail.com> wrote:
> > >>>
> > >>> In your template try {{usb_data|safe}}
> > >>
> > >> .......because django escapes everything in the template by default
except
> > >> you ask not to. One of the methods of doing so if by using the `safe`
> > >> filter
> > >> like Mario suggested.
> > >> You can read the documentation on how to escape or unescape stuff in
your
> > >> template.
> > >
> > > Thank you, guys. It works.
> > > Now I need to figure out why I still don't see my data in the jQWidget
> > > control (jqxGrid)...
> > >
> > > Anybody familiar with this library?
> > >
> > > Thank you.
> > >>
> > >>>
> > >>> On 18/01/2014 4:53 pm, "Igor Korot" <ikoro...@gmail.com> wrote:
> > >>>>
> > >>>> Hi, ALL,
> > >>>> I'd like someone to help me understand this situation.
> > >>>> Looking at the page:
> > >>>> https://docs.djangoproject.com/en/dev/topics/serialization/ the
part
> > >>>> which
> > >>>> says "Serialization formats->JSON" there is an example of how the
data
> > >>>> would
> > >>>> be serialized.
> > >>>> The sample uses the symbol "double quotation".
> > >>>>
> > >>>> On my machine I have django 1.6.1:
> > >>>>
> > >>>> C:\Documents and Settings\Igor.FORDANWORK>python
> > >>>> Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit
> > >>>> (Intel)]
> > >>>> on win32
> > >>>> Type "help", "copyright", "credits" or "license" for more
information.
> > >>>> >>> import django
> > >>>> >>> django.get_version()
> > >>>> '1.6.1'
> > >>>> >>>
> > >>>>
> > >>>> In my views.py I'm using following code:
> > >>>>
> > >>>> usb_list = serializers.serialize("json", USB.objects.all())
> > >>>> return render_to_response('html/index.html', {"usb_data":
usb_list} )
> > >>>>
> > >>>> where USB is the data model class.
> > >>>> This class overrides a __unicode__() function to produce a good
output
> > >>>> on
> > >>>> the console.
> > >>>>
> > >>>> Now when I go to the page to see it in the browser I see the data
as a
> > >>>> JSON but the data is surrounded with a text "&quot;".
> > >>>>
> > >>>> So in the docs I see something like this: "abc", while my
application
> > >>>> will show: &quot;abc&quot;
> > >>>>
> > >>>> In the index.html I have this code:
> > >>>>
> > >>>> <!DOCTYPE html>
> > >>>> <html>
> > >>>> <head>
> > >>>> <title>Test</title>
> > >>>> {% load staticfiles %}
> > >>>> <script type="text/javascript">
> > >>>>     var data = "{{usb_data}}";
> > >>>> # some more JavaScript code
> > >>>> </script>
> > >>>> <html>
> > >>>> </html>
> > >>>>
> > >>>> Is this a recent change? Am I doing something wrong?
> > >>>> Thank you.
> > >>>>
> > >>>>
> > >>>> --
> > >>>> You received this message because you are subscribed to the Google
> > >>>> Groups
> > >>>> "Django users" group.
> > >>>> To unsubscribe from this group and stop receiving emails from it,
send
> > >>>> an
> > >>>> email to django-users+unsubscr...@googlegroups.com.
> > >>>> To post to this group, send email to django-users@googlegroups.com.
> > >>>> Visit this group at http://groups.google.com/group/django-users.
> > >>>> To view this discussion on the web visit
> > >>>>
> > >>>>
https://groups.google.com/d/msgid/django-users/783144af-8478-408a-bdd5-0b7b5a5a1161%40googlegroups.com
.
> > >>>> For more options, visit https://groups.google.com/groups/opt_out.
> > >>>
> > >>> --
> > >>> You received this message because you are subscribed to the Google
Groups
> > >>> "Django users" group.
> > >>> To unsubscribe from this group and stop receiving emails from it,
send an
> > >>> email to django-users+unsubscr...@googlegroups.com.
> > >>> To post to this group, send email to django-users@googlegroups.com.
> > >>> Visit this group at http://groups.google.com/group/django-users.
> > >>> To view this discussion on the web visit
> > >>>
> > >>>
https://groups.google.com/d/msgid/django-users/CAHqTbj%3DO5ysO7cmVXFg8p-aTMbHNZ5gHA4iZ8JaVzNthVjsDkQ%40mail.gmail.com
.
> > >>>
> > >>> For more options, visit https://groups.google.com/groups/opt_out.
> > >>
> > >> --
> > >> You received this message because you are subscribed to a topic in
the
> > >> Google Groups "Django users" group.
> > >> To unsubscribe from this topic, visit
> > >>
https://groups.google.com/d/topic/django-users/uoeNHy50ozI/unsubscribe.
> > >> To unsubscribe from this group and all its topics, send an email to
> > >> django-users+unsubscr...@googlegroups.com.
> > >> To post to this group, send email to django-users@googlegroups.com.
> > >> Visit this group at http://groups.google.com/group/django-users.
> > >> To view this discussion on the web visit
> > >>
> > >>
https://groups.google.com/d/msgid/django-users/CA%2BWjgXPc0BVPpkkjOij%2BG6otewyksH7Ur7ju%3DH%3DL7%2B8HX8ZVyw%40mail.gmail.com
.
> > >>
> > >> For more options, visit https://groups.google.com/groups/opt_out.
> > >
> > > --
> > > You received this message because you are subscribed to the Google
Groups
> > > "Django users" group.
> > > To unsubscribe from this group and stop receiving emails from it,
send an
> > > email to django-users+unsubscr...@googlegroups.com.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > Visit this group at http://groups.google.com/group/django-users.
> > > To view this discussion on the web visit
> > >
https://groups.google.com/d/msgid/django-users/CA%2BFnnTyzs3h%3Dga%3DKvPArxx2-eiCVFECVPMjqc6uYnpmO%3D2SAcw%40mail.gmail.com
.
> > >
> > > For more options, visit https://groups.google.com/groups/opt_out.
> > >
> > > --
> > > You received this message because you are subscribed to a topic in the
> > > Google Groups "Django users" group.
> > > To unsubscribe from this topic, visit
> > > https://groups.google.com/d/topic/django-users/uoeNHy50ozI/unsubscribe
.
> > > To unsubscribe from this group and all its topics, send an email to
> > > django-users+unsubscr...@googlegroups.com.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > Visit this group at http://groups.google.com/group/django-users.
> > > To view this discussion on the web visit
> > >
https://groups.google.com/d/msgid/django-users/CA%2BWjgXPS4d9tW0QW_X_cvZA7f5tn2pfcM5QdzU9gSj4nut-a2g%40mail.gmail.com
.
> > >
> > > For more options, visit https://groups.google.com/groups/opt_out.
> >
> > --
> > You received this message because you are subscribed to the Google
Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users.
> > To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CA%2BFnnTyV7hbH09n_XOMk5N2Ta-ShTbzoZ-O3gHy9oQFpVy-3Wg%40mail.gmail.com
.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> > --
> > You received this message because you are subscribed to the Google
Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users.
> > To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CA%2BWjgXM%3Dj_jehgYYza3-2Ymf2YcYrobRHyTYnH-9q0yOVW7dGw%40mail.gmail.com
.
> > For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BWjgXNB173Yxy8beZjVPKtHQqe02dtRn%2B6aBR0_ahYYyfaa_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to