json

In ASP.NET MVC, deserialize JSON prior to or in controller's action method.

I am working on a website that will post a JSON object (using jQuery Post method) to the server side. { "ID" : 1, "FullName" : { "FirstName" : "John", "LastName" : "Smith" } } At the same time, I wrote classes on the server side for this data structure. public class User { public int ID { get; set; } ...

HTML output with jsp:include and json-taglib

I'm using jsp:include inside json-taglib's json:property element. The problem with this is that all HTML elements from included JSP page gets stripped at some point and only plain text remains. I have already stripped all newlines so the result shoud be valid JSON data. How do I get full HTML returned by json-taglib? Below is a snippet...

Handling Json results in ASP.NET MVC with jQuery

I am working on a view containing two forms, handled by separate controller actions which return a string serilaized to Json: return Json(message); The forms are submitted using jQuery, by clicking on a button outside the two forms. The button handler: $('#inviteForm').ajaxSubmit({ success: function(html, status) { ...

SubSonic 3 and RESTHandler

Hi, I was about to start modifying the ActiveRecord.tt template to roll my own toJson() method when I thought I really ought to see if I'm about to re-invent the wheel. I quickly came across the RESTHandler class from SubSonic 2 and I was wondering if anyone has any thoughts about what's invloved with getting it to play nicely with SubS...

Access JSON object name in PHP

I have the following JSON: {"nickname":"xadoc","level":4,"loc":"Tulsa, OK, USA","score":122597,"money":29412.5,"streetNum":8,"streets":{"-91607259\/387798111":{"name":"Alam\u00e9da Ant\u00f3nio S\u00e9rgio","value":243,"type":1},"-91016823\/388182402":{"name":"Autoestrada do Norte","value":18304,"type":1},"-86897820\/399032795":{"name"...

jquery getting stuck?

$.ajax({ url: "_includes/contactform.php", type: "POST", data:'name=' + nameValue + "&email=" + emailValue + "&text=" + textValue + "&checkbox=" + checkValue + "&submit=true", dataType:"json", success: function(data,result,res) { alert(res); console.log(data); if(data.checkbox == "true"){ $("#success h1").html("The form was sent su...

PHP "Invalid argument supplied for foreach()" on shared server

Hello. I'm working with PHP 5 here. I have the following code: $data = json_decode($_POST['data']); foreach ($data as $obj) { ...... } I get the error "Invalid argument supplied for foreach()" on the line with the foreach function. This only happens on my shared server account. On my local webserver everything works fine. $_POST['dat...

jQuery ajax issue

Hi, I've been at this bit of code for a while, but am not sure what I'm doing wrong. Basically I want to create a loop that prints out all items in a cart. If I take the loop out, it prints the item just added, but when I add the loop in, it breaks. I'm not too familiar with jQuery/JSAON, so if anyone could point out where I might be g...

Alternatives of JSON.stringify() in JavaScript

In JavaScript, what are the alternatives of JSON.stringify() for browsers that do not have native JSON support? Thanks ...

Any tutorials for using JSON, JScript and jQuery?

I just recently started using jQuery on my classic ASP site. I am planning on rebuilding a page that has 4 sections and each section displays multiple rows and columns. JSON can help me here but all the examples that I have seen are VBScript related. This site is JScript and I am looking for some examples or tutorials using JSON, JScript...

ExtJS: how to return json success w/ data using asp.net mvc

Hello, I am trying to use ExtJS with Asp.Net MVC, and it is going fine so far. (Nice work on ExtJS) To make things easier, I need some help returning data from .net to ExtJS. ExtJS expects to see a success flag in the JSON Respone along with additional data. a sample expectedresponse format is something like {success: true, data: {id...

How to remove an element from a JsArray in Google Web Tools?

I'm using Google Web Tools, and have a JsArray, which I'm populating with data from JSON. I'm able to modify items within the array and add items to it, but I can't figure out how to remove an item from it. I'm looking for something similar to the pop() method in JavaScript. I can add an item to the array by using the set(index,value)...

jQuery: Made json request, process it in callback, access it outside the callback function?

$("select[name=field[]]").live("change", function() { $.getJSON("/json.php",{id: $(this).val(), ajax: 'true'}, function(j){ options = ''; for (var i = 0; i < j.length; i++) { options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>'; } }); ...

Jquery Json dynamic variable name generation

I make a jquery .ajax call and I'm expecting a json result. The catch is, if there are say 5 authors, I'll get author_details_0, author_details_1, author_details_2, etc.... How can I dynamically construct the name of the variable to retrieve from json ? I don't know how many authors I'll get, there could be hundreds. $.ajax({ type: "POS...

how to use proxy with JSON

I have a php page called 'dataFetch.php' which sits on one webserver. On another webserver, I have a JS file which issues JSON calls to dataFetch. dataFetch connects to a database, retrieves data and puts it in a JSON format which is fed back to the calling program. In IE, this works fine. In other browsers it does not because of the cr...

Data through jquery's ajax not being sent.

Hello. I've got a webpage which needs to load some data from a database. In order to do that, I'm using jquery's $.post function, which loads a file called photoList.php, as follows: *(photoList.php)* <?php include 'mysqlConnect.php'; $query = mysql_query("SELECT name FROM images"); $photoList = Array(); while ($row = mysql_fetch_asso...

jQuery/Ajax/Json - Display respective values on submit for inputs with same class name

What I want to do is: When each button is pressed, show it's respective value. Right now the value returned is always "1". The json.php file will eventually be used to update records in a database. Any help would be greatly appreciated. Thanks! Here's the json.php file: <?php if(isset($_POST['hidden'])) { $data['value'] = $...

Using JSON Data to Populate a Google Map with Database Objects

I'm revising this question after reading the resources mentioned in the original answers and working through implementing it. I'm using the google maps api to integrate a map into my Rails site. I have a markets model with the following columns: ID, name, address, lat, lng. On my markets/index view, I want to populate a map with a...

Javascript: JSON Strigify changes time of date because of UTC!

Hi, can anyone help, my date object in javascript are always represented by UTC +2 because of where i am located. hence like this Mon Sep 28 10:00:00 UTC+0200 2009 Problem is doing a Json.stringify converts the above date to 2009-09-28T08:00:00Z (notice 2 hours missing i.e. 8 instead of 10) What i need is for the d...

Javascript new RegExp(), reading patterns in from JSON

I'm trying to create a bbcode filtering solution that works with both PHP and Javascript. Right now I'm working on the javascript. I'm having trouble getting the new RegExp constructor to recognize the patterns in my json. Here's a small bit of sample code that reproduces the issue. Any insight would be greatly appreciated! bbcode.json ...