Re: How to send data from gwt TextBox to PhP server via JSON

485 views
Skip to first unread message

Joseph Lust

unread,
Aug 2, 2012, 10:34:05 AM8/2/12
to google-we...@googlegroups.com

// username and password sent from form 

$myusername=$_POST['myusername'];

$mypassword=$_POST['mypassword'];


You will need to json_decode() the request before you can access the variables within. Further the incoming request JSON should be assigned to a variable (i.e. msg=JSON) so that PHP can fetch it from the $_POST variable.

Frankly, given that you only have two parameters, there is really no reason to JSON encode them. Just POSTing the two parameters as form encoded data would work with your PHP code as written. You can however us JSON to return a response.


Sincerely,
Joseph 
Reply all
Reply to author
Forward
0 new messages