Hello. I am using Zend Framework.
My task is to send JSON data from controller to Javascript.
I have an simple array:
$array = array('a' => 1, 'b' => 2);
After i am encoding this array to json format:
$jsonData = Zend_Json::encode($array);
But I don't know, how I can get this data in Javascript. I send an ajax request with jQuery....
So I'm using ExtJs to post JSON for updates and creates to my ASP.NET MVC 2 application. I'm also using the ValidateAntiForgery attribute which only works when a POST is made.
Question is: Can I use model binding in this scenario and if so, how?
Here is an example of what the JSON looks like when I attempt to update a 'Company' entit...
I am trying to serialize a class that contains a List of other objects. I am using the json.net library. I am serializing as follows:
return Newtonsoft.Json.JsonConvert.SerializeObject(businessObject, Newtonsoft.Json.Formatting.None);
The json that is produced does serialize ok, but the List does not seem to be serialized as a json ...
Hey i am developing an iPhone app of a existing PhP mySQL website. i want to know, how to pull data from database and display on the phone?
after going through several articles , i found out two ways..
1) create a web service, on server end, which will provide all the data in XML format to the device.
2) export php,mysql data in JSON f...
Hi,
I need to get data from JSON, transfered by ajax from client. Basically I used something like this:
@route('/ajax')
def serve_ajax():
return main.parse_request(json.dumps(dict(request.GET)))
Where main.parse_request is a function, that contains some logics to deal with variables in JSON (it is a main procedure of our game engi...
here is my web service :
public class Header : System.Web.Services.WebService {
public Header () {}
[WebMethod]
public string GetArchive(string PageID)
{
StringBuilder sb = new StringBuilder();
BusinessRules.News news = new BusinessRules.News();
BusinessObject.NewsItemList newsList =
n...
I want to create a hello world json rest webservice in test.php:
<?php header("Content-type: application/json; charset=utf-8");
$test[] = "hello";
$test[] = "world";
$json = json_encode($test);
echo $json;
?>
But nothing is returned when I test it with ajax below why ?
<html>
<head>
<script>
function ...
Hi,
I try to make a connection between arduino and Flex 4.0, I added the JSON lib and also as3corelib.swc to Flex. When I run the Flex file the connection between PC to arduino is working (I can see it in SERPROXY window) and also I don't have any problems in Flex window, I added the SWF file of Flex to the list at //http://www.macrom...
Hi guys,
I am thinking to work on two combos for: country and city.
When user selects country in first combo, its cities should be populate in the city combobox.
For it:
1.) Prepare 2 javascript variables: first one with countries id and name, second one with cities id, name and country_id
For Countries:
[
{"id":1, "title":"uk"},
{"i...
function loadSavedSort(start) {
start = parseInt(start);
if ( isNaN(start) )
start = 0;
var listing = $("#viewsavedsort .listing");
listing.find('.item').remove();
var start = $('#savedSortStart').val();
$.getJSON('saveajax.php', { 'start': start },
function(data) {
$("#viewsavedsor...
Dear StackOverflow: I have thoroughly researched this question and can't find a solution. Any help would be greatly appreciated.
I have a bunch of elements on a page, all of whose ID's are stored in an array called ids[].
I have initialized a third-party DOM script for each of these divs that detects when the element has been dragge...
I have never worked with json before. I am trying: http://api.worldbank.org//topics?format=JSON and make things with it, but I don't even know how to get started.
Following some manuals, I did this:
import urllib
import urllib2
import simplejson
urlb = 'http://api.worldbank.org/topics'
datab = urllib2.urlopen(urlb+'?'+ param)
resultb =...
Hi,
I'm using CouchDB and I have a situation where there are a bunch of documents keyed on user ids. I would like to be able to send a single query to update a particular field in all these documents. For example when a notification comes in, I'd like each user document to be updated with it by passing in the list of users to whom the n...
What I'm doing is grabbing JSON off a website to deserialise it with a DataContract class. So what if the response I get doesn't match the class? I would be getting a SerializationException, but I'm thinking it would be better as an InnerException to a different exception, as the response is therefore incomplete or not JSON at all.
Righ...
Happy Halloween everyone, hope it was a fun night!
I've just implemented an AJAX search functionality on my first ever ASP.NET MVC project, and I just want to get your feedback on security and performance.
The project is going to be a simple Forum, with roughly 40 topics and 1000-3000 total posts.
Let me show you some code.
In my Top...
Hi! I have this ReGex expression in JavaScript right now: /(.*)(,)([\]\}]+)$/.exec(stringData).
Basically it's removing any trailing comma from a malformed JSON string, (by concatenating r[1] + r[3] you get it).
It's working well except it's way too slow on big strings. So a regex is not a good choice here. I would like to convert this ...
I'm taking my first steps to explore Spring MVC 3 (annotation driven) and the JSON functionality that it supports.
1) In my JSP page I want to click a link that retrieves JSON
$("a[class=simple2]").click(function() {
$.getJSON("checkName.html", function(contacts) {
alert(contacts);
});
return false;
});
...
Hi, i would like to have an JSON like data format with the following features:
support of arrays (ideal with [item; item; item] as notation and [key: value; key2: value2]), also nested
string support, ideal with the following: "foo",0x0a,"bar"
hex numbers, bin numbers, decimal numbers
Does anyone know a parser for such a data format ...
I am trying to send json data from an HTML form back to php server via a POST method. Here is my code. It goes to fail block in callback function. Firebug console(ctrl+shift+J) displays no error.
<script>
function ADDLISITEM(form)
{
var options = form.txtInput.value;
options = JSON.stringify(options);
var url = "conn_mysql.php"
var ...
Hi, i need decode this Json with the PHP, but i dont know how. I saw this function php.net/json, but it haven't how to decode this type of data.
{"c":[{"v":"0","e":"","n":"45","cc":"PSDB - PTB \/ PPS \/ DEM \/ PMN \/ PSDB \/ PT do B","nm":"JOSÉ SERRA","nv":"VICE: ÃNDIO DA COSTA"},{"v":"0","e":"","n":"13","cc":"PT - PRB \/ PDT \/ PT \/ ...