how do i convert my value from json_decode to string so i can pass in a the string value to check if an email exists here is my code.
my json is in this format:
{email:'test@test.com' }
PHP:
$var = json_decode($_REQUEST["email"], true);
$result = $membership->CheckEmailAddress($var); // get $var to become a string
It looks pretty ugly im just starting php and Im not getting very far aye lol.
jquery:
$('#checkemail').click(function () {
var json = {
email: $('#email').val()
};
$.post('http://' + location.host + '/buyme/include/getemailaddress.php', {
'email': 'test@yahoo.co.nz'
}, function (res) {
var obj = JSON.parse(res);
alert(obj.message)
});
});
also how do I put my json variable in my $.post function cose thats the value I want to put there
what value in $_REQUEST[“email”] if it’s a json value you are showing above then try
your $var is a json object you can fetch email value like not use $var it’s an array
tried this :-