json

Trying to use JSON with jQuery

Hi all, I'm trying to get json working using jQuery 1.4.1 but I'm getting a null object. Here's an example of not working code: (using $.ajax which has the 'success:' ) $.ajax({ url: 'http://isohunt.com/js/json.php', dataType: 'json', success: function(data) { alert('Worked'); alert(data); } }); What i...

Discrepancy in JSON.stringify of date values in different browsers

I have this code in an HTML page: alert(JSON.stringify(new Date())); I'm including the latest json2.js (2009-09-29 version) in my page to support older browsers without JSON.stringify(). I also have jquery-1.3.2.js included. I believe in newer browsers with native JSON support, it just passes through to the native JSON feature. Her...

When using AJAX should you do everything through AJAX or is it OK to use headers too?

I know when you request a page normally it is typically the case that you would use server side session data and set cookies via HTTP headers, but does it work the same when the content is requested via AJAX? ...

Problem with my JavaScript AJAX request in IE8

I have a products range on this site http://vanquish.websitewelcome.com/~hawko/hawko-lighting/led/ using jQuery In Firefox / Safari, clicking view will allow you to see more details on the product on the right. This includes a gallery (if > 1 images), a download specs sheet if one is available and view more details. The JavaScript wor...

dojo.data.ItemFileReadStore + dojox.grid.DataGrid + 100% width and height

I want a dojox.grid.DataGrid with a dojo.data.ItemFileReadStore as the data store. I want it to fill the entire screen. I don't want to specify dimensions in pixels. All the examples that I've seen specify them in pixels or use a CSV data store. I've tried using HTML elements and javascript to setup the datagrid and store. Has anyone do...

How much external data is too much? (XML or JSON)

I have written pure JavaScript front ends before and started noticing performance decrease when working with large stores of data. I have tried using xml and json, but in both cases, it was a lot for the browser to handle. That poses my question, which is how much is too much? ...

Serializing a scala object into a JSon String using lift-json

Dear all, I am wondering, would you please let me know how can I use lift-json to serialize a simple bean class into json string (I'm using v2.0-M1). I tried: val r = JsonDSL.pretty(JsonAST.render(myBean)) and I am getting [error] found : MyBean [error] required: net.liftweb.json.JsonAST.JValue Thanks, -A ...

How to use a variable value for the key of another object?

I have something like : var myMenu= [ { 'My English Title':function(menuItem,menu) { ... } }]; Now, I want the replace 'My English Title' by an other JSON structure value LOC.MENU_TITLE. I have try: var myMenu= [ { LOC.MENU_TITLE:function(menuItem,menu) { ... } }]; Bu...

serializing and deserializing a json object through Lift-JSON

Hi all, I have a exception from lift-json when I want to deserialize a json string. (using v2M1). Basically I have the following class: @BeanInfo case class Game(val id:Int, val bad:Map[String,Plan], val good:Map[String,Plan]) and I am using net.liftweb.json.Serialization.read[Game](jsonInString) to deserialize the jsonInString...

JavaScript objects and persistence through dialogs

Hi, Rather simple question here. I want to create an JS object that has a property, say, name. I want to create that object and be able to use it throughout my page. For example, what I have now doesn't work: var item = new Object(); function makeItem(title) { item.name = title; } Inside a modal dialog: makeItem("test"); alert(i...

Utilising JSON values in Javascript

I'm originally a PHP programmer and have been struggling with this for at least 2 whole 9-to-5 days now. I've come a long way but I seem to have gotten stuck trying to figure out the last bit. It SHOULD be fairly simple, but somehow I can't seem to find anything that coulp help me figure it out. I have the folliwing jQuery code that ret...

Good javascript library for drawing charts using json...

Can you suggest me some of good javascript libraries for drawing charts with json data... I thought of using Jqplot chart plugin for jquery javascript library... Some more would be useful... EDIT: List of chart types would be very useful for the suggested library... ...

How to use regular expression in json(PHP) ?

Hello, Now i have a json code like this: {"1": { "text":"e1", "children": { "1": { "text":"e1_site1", "children": {"1":"e1_site1_salarie1_nom"} }, "3": { "text":"e1_site2", "children": ...

how do you convert a string into a Json object to return to a jquery getJson call

i have code in csharp that returns this string: {'dateTimeFormat': 'iso8601', 'wikiURL': "http://simile.mit.edu/shelf/", 'wikiSection': "Simile Cubism Timeline", 'events' : [ {'start': '1924', 'title': 'Barfusserkirche', 'description': 'by Lyonel Feininger, American/German Painter, 1871-1956', 'image': 'http://images.allposters.com/imag...

Using respond_to ... format.json and jQuery Form Plugin by malsup

Hello all, I'm having a tad bit of trouble getting the jQuery Form Plugin to work properly with a file-upload field. When I use the plugin to submit the form without a file-upload field, the format.json portion of the respond_to do |format| block is called properly. However, by adding the file-upload field, it only executes the format.h...

ASP.NET MVC 2 One Route Works, One Route Doesn't

I have two routes in my ASP.NET MVC application. The first is working fine - it's an ActionResult that returns a view. The second is on the same controller and is an ActionResult that returns a Json response. It takes a couple of additional paramaters. This second route is working on my dev machine, but when I deploy it to the server ...

Access dynamically named JavaScript Objects?

Hi, I have a JS Object: var testObj = new Object(); that has a property called volume1, so testObj.volume1 has a value. How would I go about accessing that property by using something along the lines of testObj.volume + "1" To give it more context, the object actually has more properties, like testObj.volume1, testObj.volume2 ...

How can i render a json response from a hash while maintaining order in ruby on rails?

hey out there, i am failing to render a json response in ruby on rails from a hash datastructure of country-names with their country-codes: { "AF"=>"Afghanistan", "AL"=>"Albania", "DZ"=>"Algeria", ... }, so that the json response has its entries alphabetically ordered like this: { "AF":"Afghanistan", "AL":"Albania", "DZ"=>"Algeria" ... ...

Unicode parsing problem using json.loads

Hi What is the best way to load JSON string in Python. Here is my code which give problem for loading json strings... import json json.loads(str_to_load) I also tried supplying 'encoding' parameter with value 'utf-16', but that didn't work either... Can you please help me solve this problem? Thanks ...

Python design question

I'm a C programmer and I'm getting quite good with Python. But I still have some problems getting my mind around the OO awesomeness of Python. Here is my current design problem: The end "product" is a JSON data structure created in Python (and passed to Javascript code) containing different types of data like: { type:url, {urlpayload...