I am using "remote" request option of jquery Validate plugin and also data is passed.
Is there any way to check what value is passed in the request?
I want to output userID variable that is being passed.
Here's a part of validation:
personal_email: {
email: true,
remote: {
param:{
url: app.baseurl('user/check_personal_email'),
type: 'POST',
data:
{
userID : function()
{
return $("#userID").val();
}
}
}
// ,
// depends: function(element)
// {
// return ($('#editTrue').val() == undefined && $('#editTrue').val() == null);
// }
}
},
And here's the controller's function that handles the request and send the result:
public function checkPersonalEmailExists($f3)
{
$userID = $f3->get('POST.userID');
echo "<script>console.log( 'User ID: " . $userID . "' );</script>";
$email = $f3->get('POST.personal_email');
$user = new UserModel();
$records = $user->checkIfPersonalEmailExists($email);
if(count($records) > 0)
{
foreach ($records as $record)
{
$user_id = $record['id'];
}
echo ($userID == $user_id) ? 'true' : 'false';
}
else
{
echo 'true';
}
}
I tried echo "<script>console.log( 'User ID: " . $userID . "' );</script>";
.
Any help is very much appreciated. Thanks.