JSON encoding in as3

I have this code which Im using to pass data in JSON encoded format to php. Is there a way i can check at the php end if it was received and beamed in proper format?

var people:Array = new Array();
    var person:Object = new Object();
    var url:String = "http://localhost/ping.php";
    var request:URLRequest = new URLRequest(url);
    var requestVars:URLVariables = new URLVariables();
    var loader:URLLoader = new URLLoader();
    person.fullname = "jon jay junior";
    person.username = "jjj";
    person.role = "ADMIN";
    people.push(person);
    request.method = URLRequestMethod.POST;
    requestVars.myObject = JSON.encode(people);
    request.data = requestVars;
    loader.load(request);

Answers


As others have mentioned, you should look at the request with Firebug, LiveHTTPHeaders, or a similar tool (there are several for Firefox). This will let you see the format of the data.

If $_REQUEST['myObject'] is indeed null in PHP, then something is wrong. You should really attach a loader.addEventListener(IOErrorEvent.IO_ERROR, handleIOError); to check for problems and/or run with the debug Flash player so you can see any exceptions going on.

If you are running this in a browser, a debug trick is to call Firebug's console.log via an ExternalInterface.call()


Need Your Help

What's the correct way to use https://doesthisgifcontainananimation.com with http://i.imgur.com/tYqyhJT.gif for example?

html json get request animated-gif

Or someone else can confirm that this is an incomplete work because I'm getting every response except the ones listed.

How can I write a large multidimensional array to an HDF5 file in parts?

c# .net multidimensional-array hdf5

I'm using HDF5DotNet in C# and I have a very large array (several GB) that I want to write to an HDF5 file. It's too big to store the whole thing in memory, so I'm generating regions of it at a tim...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.