Sunday, 15 February 2015

javascript - convert json object to serialized string for server side processing? -


I am trying to convert a generation object into a serial string which is something I want to do with some PHP server side code I can process further with:

Returned object looks like this:

  object {id: "123456787654321", email: "some-email @ gmail I can convert the object to a string in the following: , first_name: "first", gender: "male", last_name: "last"}  

  var paramString = JSON s Tringify (feedback); Console.log (paramString); // does not work // var params = paramString.serialize ();  

How do I change the string to a serialized string which I pass through my client with the following client side call

I would expect something like this:

  id = 123456787654321 and email = somemail@gmail.com& First_name ...  

My server side code:

  $ Post ("/ functions / test_functions.php", {params: params}, function (data) {...}, "json");  

I handle the parameter array like this server side:

$ vars = $ _SERVER ['REQUEST_METHOD'] === "Received"? $ _GET: $ _POST; $ Params = array (); Released ($ wars ['params'])? Parse_str ($ vars ['params'], $ params): zero;

You can pass JSON-string to server and it will be json_decode () Can decode with See for details.


No comments:

Post a Comment