json

Problem retreiving array values in jquery

My code: $.get('ajax/time_menus.php', { shift: $('#shifts').val() }, function(data) { //load the array into a test element so we can see what is returned $("#test").html( data ); //set the hour menu var startHour = data[0]; alert( startHour ); $('#from_hours').val( data[0] ); ...

Best way to handle expired .NET Forms authentication coookie in an ajax call?

I'm developing a ASP.NET MVC app and I'm wondering which is the best way to handle an expired .NET Forms authentication cookie detected during an ajax call. Do you think that packing the ajax response into a JsonResult containing info about the cookie validity is the best solution? ...

How do I retrieve values from dojo.data.ItemFileReadStore

First, I read this short help thread here: CLICK It uses a JSON file built together with PHP which looks something like THIS: { name:'Italy', type:'country' }, { name:'North America', type:'continent', children:[{_reference:'Mexico'}, {_reference:'Canada'}, {_reference:'United States of America'}] }, { name:'Mexico', type:'count...

How to parse ASP.NET JSON Date format with GWT

ASP.NET JSON serialize DateTime to the following format "\/Date(1251877601000)\/". Pls, help parse this string into the java(GWT) Date object. At this time the solution I came with is parsing with regex, extract long.. but then I cannot push long through JSNI. ...

Passing JS variable name to function?

Hello all, So here is what I am trying to do: 1.My variable named data_1 is set. var data_1 = { "y_legend": { "text": "# of Patients", "style": "{font-size: 20px; color: #778877}" }, "x_legend": { "text": "AUG 09 - OCT 09", "style": "{font-size: 20px; color: #778877}" } }; In a drop down a user selects an op...

ASP.NET MVC | Problem about showing modal dialog using jQuery dialog widget

I am very fresh to asp.net mvc and jQuery. After one day trying, I still don't know how to pop up a jQuery dialog using data from a action(return JsonResult) while user click a link. Any suggest or guideline is appreciate. Thanks! ...

Can I Deserialize a JSON string into an object if I only know the parameters of the objects' constructor?

This is like a follow-up question to this one. Basically what I'm doing is exposing some fields on some UI to some user. These fields are established based on the parameter list of a given objects constructor. The user has the options to choose which object the UI is displaying by, oh I don't know, let's say picking an object from a dr...

How can I validate a JSON string against a schema programmatically?

Are there simple libraries out there (.NET and Java) that are able to validate a JSON string given a schema definition? It should work similar to how XML can be validated using XSD. EDIT: I need .NET and Java libraries. Thanks to darin for the .NET link! ...

Ip to country, city, lat, lang javascript service

What the best/accurate/free service to convert the IP from the following script to country/city/lat/long? $.getJSON("http://jsonip.appspot.com?callback=?", function(data){ alert( "Data Returned: " + data.ip); }); ...

How to set selected item in dropdown list using jQuery

Hi all I'm using the following jQuery function to populate a dropdown list. Once the user selects an item I am storing the selected value in a session variable and Im able to get the data back from the session variable via a hidden filed in to a variable (selectedApp) after a postback. The problem is that after a postback I am not able ...

JSON - not all fields quoted in Dojo diji.tree sample code in book

O'Reilly book "Dojo - The Definitive Guide" page 378 shows the following sample Tree structure which is supposedly JSON. It seems to work in building the Dijit Tree structure. { identifier: 'name', label:'name', items: [ {    name: "Programming Languages",      children: [ etc... Should the word identi...

How do I process Proxy Digg JSON for use with jQuery?

I'm trying to deal with: "Requests made from Javascript running on your web pages must be proxied to avoid same-origin policy conflicts." I know how to work with the JSON once I've got it. But aside from copy-pasting the JSON results via my browser, I don't know how to localize it for use. ...

Passing JSON-encoded variable from PHP to Javascript via POST

I have an multi-dimensional array that I want to send to a PHP script with a Javascript that parses the JSON data and plot it on Google Maps. I'm trying to simulate it using forms: <?php $jsontest = array( 0 => array( 'plate_no' => 'abc111', 'longlat' => array(121.003895,14.631563), 'info' => 'first item' ), 1 => array( 'pla...

On $.Post in Json used in ASP.NET MVC 1.0 i am getting exceed maxlength error

i am getting this error given below i guess its a max length exceed error when i call a action in a controller using $.post method can you tell me what setting should i put to increase the length System.InvalidOperationException: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string...

Large numbers erroneously rounded in Javascript

See this code: <html> <head> <script src="http://www.json.org/json2.js" type="text/javascript"></script> <script type="text/javascript"> var jsonString = '{"id":714341252076979033,"type":"FUZZY"}'; var jsonParsed = JSON.parse(jsonString); console.log(jsonString, jsonParsed); </script> </head> <body> </body> </html> Wh...

How do I write json results to a div using jquery?

This is probably a really easy question, but I can't find anything that works. I'm trying to take a json result and just write it into the inner html of a div to see what it looks like. I have something like this: $.getJSON("someurlthatgivesmejson", function(data){ $("#jsonmodel").html(data); // what should this ...

Which format for transmitting data over TCP?

Hi, I'd like some advice on which format to use for transmitting data over TCP. Currently, I have devised a simple text-protocol with delimited strings. I'm thinking I should use something out there that already exists such as XML, JSON, or XMPP? What data formats do people use for transmitting over TCP? I would like to optimize for...

How can I configure ASP.NET web service to only send LocalDateTime property of DateTimeOffset object as JSON?

I have a bunch of entity class (generated by Linq to SQL) with a few DateTimeOffset properties in it. When I send that over the wire as JSON from a .asmx web service, the JSON serializer generates the following JSON: {"DateTime":"\/Date(1252142834307)\/", "UtcDateTime":"\/Date(1252142834307)\/", "LocalDateTime":"\/Date(1252142834307...

jQuery Bookmarklet with $.post() or $.get()

Hi. I've built a Bookmarklet based on Ben Almans jQuery enabled Bookmarklet. The bookmarklet creates a an fills it with some data from a $.get('http://mydomain.com/request/') Request. It works as long as I am on the same domain, but if I try to run it on another site, e.g. google the $.get() does not work. I've also tried $.getJSON()...

How to simiulate a JSON call from an HTTP GET Call?

At this moment I am calling my index view in one of two ways. Using the normal http view and serializing it JSON. In order to test it I am using the code below, and it works. I want to get it with a http get call. Like (http://localhost/article,json or something similar. Any ideas. $.getJSON("/Article", function(json) { $...