json

Asp.net Mvc Ajax Json (post Array)

javascript\jQuery: > var items = new Array(); > > var obj { Begin: "444", End: "end" }; > > items.push(obj); items.push(obj); > > var request = { > DateStart: $("#DateStart").val(), > mass: items > }; > > > $.post("/Home/Index", request, null, > "json"); C# Mvc Index Controller public class My...

jQuery recursive iteration over objects

The other day I thought I saw an object iterator in jQuery that had a flag that could be set to recursively iterate over child objects. I thought it was part of jQuery.each(), but now I don't see that capability in the docs. Is there any such iterator in jQuery that can be automatically recursive? (I know how to do it in javascript. J...

JQuery- ui dialog return value & iplocation data retrieval

Basically, I referred to some sources, and found this: "Yah, that's easy, just create a div on your page, put the form in there, and make that your dialog." Well that's great, but what if you're trying to achieve maximum compatibility? What happens if for whatever reason a user has JavaScript disabled in their browser? Suddenly that e...

Populating dropdown menu with JSON Data

Hi Guys, Im tyring to use AJAX to populate a dropdown box based on the selection of another dropdown. I followed a tutorial using jQuery located here - http://remysharp.com/2007/01/20/auto-populating-select-boxes-using-jquery-ajax/ and have altered the select box ID names in the select box names in the script. When a chagne the value o...

How do I iterate through the Attributes of a C# class (.NET 2.0)?

Say I have a class: public class TestClass { public String Str1; public String Str2; private String Str3; public String Str4 { get { return Str3; } } public TestClass() { Str1 = Str2 = Str 3 = "Test String"; } } Is there a way (C# .NET 2) to iterate through the Class 'TestClass' and print out public variables and a...

EF -> WCF -> JSON

I have a Windows Communication Foundation service which queries the Entity Framework and retrieves data in the form of Entity objects. I'd like to serialize these objects to JSON and send them back to the client to be interpreted in Javascript. It seems this is tricky, according posts like these: http://bloggingabout.net/blogs/progr......

Help writing a valid multi-dimensional array into JSON

Hey all, I'm trying to return a JSON string from an AJAX call to my database but I'm having a bit of trouble... I can't seem to get the notation of my JSON correct as it keeps evaluating to a single dimension array and chopping off a bunch... Here's an example of what I have so far (truncated for brevity's sake): [{"Credit", "Acc...

Flattening a complex json object for mvc binding

My controller is returning an object graph to the view in json format like this return Json(customer); On the view my json object looks like this { Name: 'Joe', Budget: { Amount: 500, Spend: 100 } } Which maps correctly to my customer object: public class Customer { public string Name {get;set;} public Budget Budg...

finding clicked id deep in document using jquery

I'm going to use the text from the jquery example, For example, consider the HTML: <lots of divs to get to here> <div id="#targetid_0"> Click here </div> <div id="#targetid_1"> Trigger the handler </div> I have a series of questions that are plaguing me... Assuming that I click on 'Click Here' or 'Trigger the Handler': If I'm ...

JSON RPC - What is the "id" for?

I don't understand what the ID is for in JSON RPC. Also, how bad is it considered to not use JSON-RPC.org's standards when developing a toolkit? There seems to be some ambiguity in the JSON-RPC world. P.S. The ID I'm referring to is the id in here: {"params":["Hello","World"],"method":"hello_world","id":1} ...

cross domain XML response issue

Ok so I found a plugin from here: http://github.com/jamespadolsey/jQuery-Plugins/tree/master/cross-domain-ajax That is supposed to return an xml feed that is not on my local server which would usually not work due to a cross domain policy error. And i'm supposed to be able to use a normal jquery GET call. I have included the plugin co...

Passing javascript code in JSON

I am making an AJAX call with jQuery to a PHP script that needs to return javascript code embedded in a JSON result for the jQuery code to execute. How do I go about passing javascript code in JSON? ...

Dynamically updating html table with JSON using jQuery for complex object

I am still new to JSON/jQuery. I need some quick guidance on how to dynamically populate Html table on the client. My table has fixed columns, but rows grow dynamically depending on data retreived. Say I have a Web Method on the server (GetActiveUsers) that is returning, say n- users. I am using this sql: select userId, Title,Surname,...

iPhone UITableView populateing from connectionDidFinishLoading

Hey all. I have been trying for hours to figure this out. I have some JSON from a NSURLConnection. This is working fine and I have parsed it into an array. But I can't seem to get the array out of the connectionDidFinishLoading method. I an am getting (null) in the UITableViewCell method. I am assuming this is a scope of retain issue, bu...

Client-side templating frameworks to streamline using jQuery with REST/JSON

I'm starting to migrate some html generation tasks from a server-side framework to the client. I'm using jQuery on the client. My goal is to get JSON data via a REST api and use this data to populate HTML into the page. Right now, when a user on my site clicks a link to My Projects, the server generates HTML like this: <dl> <dt>Cl...

Integrating a javascript object with jquery

I have this js object which I got from php through jason_encode(). This object has 2 objects, Name and Video. Then through a for loop I distribute the names into divs. My problem is I need to create a link in each div that would create a dialog that displays the video. I'm basing this idea from the jquery UI example: http://jqueryui.co...

What's a clean way to adorn Django models with request-specific attributes?

I'm serializing User objects to JSON, and I'd like to indicate in the JSON response whether the serialized user is friends with the user making the request. I've added a to_dict() method to my User model that does the pre-processing necessary to serialize the object--that would be a nice place to add an attribute indicating friendship, ...

trouble installing ruby gem json on my mac

I get this warning when trying to install the json module via ruby gems. Any ideas? Mac-Mini poulh$ sudo gem install json Password: WARNING: File '/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 /specifications/json-1.2.0.gemspec' does not evaluate to a gem specification ...

How can my Django views know which template to render, or whether to return JSON?

Our site can be accessed from a full browser, from mobile browsers, and from a custom iPhone app. Since the logic is mostly the same regardless of the client, we're using the same views to process all types of requests. But at the bottom of every one of our views, we have something like: if request.is_mobile(): return render_to_resp...

Fix JQuery-1.4.1 and json-2.0 conflict in json.parse regex conflict with "$" character

After upgrading to jquery 1.4.1 i noticed there was an error anytime i tried calling json.parse. The issue is part of the regex used in json. it uses a $ in the pattern that conflicts with JQuery's $ shortcut. I don't want to use the non-conflict option with jquery because i have tons of places i'd have to replace the $ with the new cor...