json

Wait for response with $.getJSON()

I'm (trying to) using JSON with PHP. I want to plot a graph using this plugin: http://www.jqplot.com The problem is: It's being plot before the new data arrives. Is there anyway to make jQuery wait for the $.getJSON() and the plot it? myArray and title are the new data that will be used later. $.getJSON('./ajax/refreshData.php', funct...

How do I post JSON payloads to a web service using PHP?

Hi all, we are using a web service which receives JSON payloads and sends back JSON payloads as response. I know how to do it c#, but unfortunately it doesn't seem easy doing the same thing in PHP. here is our c# code, what is the equivalent piece of PHP code of this?? String str = "https://thewebservice.com"; str += "?...

Trouble binding JSON data to JqGrid

Hi All, I am having a lot of trouble binding my Json data to a JqGrid. In my Default.aspx.cs I have the following method : [WebMethod] public static string GetData() { CustomerHelper C = new CustomerHelper(); var data = C.GetAllCustomersSerialized(); return data; } The "C....

Cannot upload a file to a webservice and get the response in Json format

I have a simple webservice that I would like to upload a file to. The problem is that I need the response in json. Form my experience in order to get a response in Json my request has to have a content-type of 'application/json'. But ofcourse this cannot be the case with a file upload since the content type will have to be 'multipar...

jQuery JSON AJAX call retrieving more than expected

I am calling this JSON file: { "data" : [ { "type" : "file", "target" : "TheGreatest.doc", "workspace" : "Huddle Workspace One", "user" : "Chan Marshall" }, { "type" : "comment", "target" : "martes.mp3", "workspace" : "Huddle...

Json.net / ASP.NET web service - How to return and parse dates?

After much head scratching as to why my returned Json string is breaking JSON.parse, I have realized that it is the returned dates that it doesn't like. .net property:- [JsonProperty("start")] [JsonConverter(typeof(JavaScriptDateTimeConverter))] public DateTime Start { get { return _start; } set { _start...

store return json value in input hidden field

Hi all, I was wondering if it's possible to store the return json in a hidden input field. For example this is what my json return: [{"id":"15aea3fa","firstname":"John","lastname":"Doe"}] I would like to just store the id in a hidden field so I can reference it later to do something with it. ex: I have something like this... ... and...

Parse json with gwt 2.0

Hi all, i'm trying to parse JSON coming from a flow in my gwt 2.0 application. What is the best way ? Should I use javascriptobject ? JSonParser ? I'm lost with what I'm founding on the web because there's never the gwt version. String text = "{\"item\":[{\"Id\":\"1\",\"Name\":\"Bob\"},{\"Id\":\"2\",\"Name\":\"John\"},{\"Id\":\"3\",\"...

parsing serialized Dictionary<string, string> jquery

i've managed to serialze a Dictionary collection. I return it from the webservice to jQuery ajax as a string then i place the return value into the javascript variable that i've declared as an array: var myHistoryList = {}; .... success: function(retVal) { myHistoryList = retVal.d; ...

Jquery, reading JSON variables received from PHP

Sorry if this is basic, but I have been dealing with figuring this out all day and have gotten to where I can do everything I need with Jquery and cakephp (not sure if cakephp matters in this or if its same as any PHP), I want to return a variable from a cakephp function to jquery, I had read about how to do it, like here: the cakephp: ...

JSON Array Question

How to use jsp to get json resulting in folowing format ? { "firstName": "John", "lastName": "Smith", "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": 10021 }, "phoneNumbers": [ "212 732-1234", "646 123-4...

Return both JSON and HTML in AJAX call

Hi all, I have a few pages with an heavy javascript usage (e.g. sorting and filtering of a dataset). The typical usage is to display a list of complex items (usually rendered as <li> with some HTML inside): the user can delete, edit or add items with specific forms. Since the items are complex, I keep an array of javascript objects to ...

jQuery Galleria image gallery real world working example with JSON

Is there any real world working example that uses JSON in Galleria plugin to fetch images from? ...

Deserializing json array using gson

Continuing from this question. I'm having trouble deserializing the following json array (Sorry for the size): "geometry": { "type": "Polygon", "coordinates": [ [ [ 771230.894373, 4422896.962001 ], [ 804804.852796, 4451159.130080 ], [ 876828.563339, 4417873.954498 ], [ 959794.979827, 4430944.287708 ], [ 910992.515063, 4372980.866944 ...

Manually build JSON encodable array in PHP...

This is kind of a strange one. I have a CSV that I'm uploading and passing to a PHP script that parses it into arrays, encodes it into a JSON string and sends it back to be further processed by my Javascript. However, I am having difficulty getting the response in a format that is easily parsed. Maybe it can be parsed, I'm just not su...

Firefox extensions: are cross-domain JSON calls allowed?

Hi All, Can a Firefox extension/add-on make a cross-domain JSON request? Normally for in-page javascript this is not allowed, forcing a JSONP work-around. Thanks Richard. ...

How i can make json child nodes (JSON inside JSON)?

I try to use the jquery + json to get all elements in form and build a JSON var to post in a ASP.NET MVC method. $.fn.serializeObject = function () { var o = {}; var a = this.serializeArray(); $.each(a, function () { if (o[this.name]) { if (!o[this.name].push) { o[this.name] = [o[this.name]]; } o[this.name].pu...

Deserialization to a Java object using JSON?

Hello, I must receive the following JSON: { "method":"methodName1", "args":{ "arg1Name":"arg1Value", "arg2Name":"arg2Value" } } Here's another example: { "method":"methodName2", "args":{ "arg1Name":"arg1Value", "arg2Name":"arg2Value" "arg3Name":"arg3Value" "arg4Name":"arg4Value" ...

Is anyone storing raw SVG data inside mongodb?

I'm working on a project where I'm looking to store raw svg data inside my mongodb. Right now, it appears a bit goofy because I need to escape the svg string like so: { "_id" : ObjectId("4c61e60d4d02da615f175b6e"), "name" : "Triangle", "svg-data" : "<?xml version=\"1.0\" encoding=\"utf-8\"?> <!-- Generator: Adobe Illustrator 14.0.0, SV...

Problem sending json jQuery ajax to php and back

I'm having problems sending a json jQuery array via ajax to a php script. What is the problem here: var tee = $('#voting_image img').attr('id'); var vote = 1; var thing = {tee: tee, vote: vote}; var encoded = $.toJSON(thing); $.ajax({ url: '/vote_save.php', type: 'POST', ...