Jump to content

json to php


AndrewM16921

Recommended Posts

Hey, So I'm trying to teach myself how to use json with php, made a simple example. I have a script on the browser side

var data = JSON.stringify({'username':user,'password':pass});$.ajax({  url: 'login.php',  type: 'POST',  data: data,  contentType: 'application/json; charset=utf-8',  dataType: 'json',  success: function(result)  {	alert(result);  }});

So, in login.php how do I access the data I sent? Is it in the $_POST array? And if so... what's mapped to it? I know there's the json_decode/encode functions, but my problem is finding the object to use it on and I have no idea. O_o Help appreciated. Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...