Reputation: 637
hey there i have this jquery:
var input = JSON.stringify(data); // output: [100.100]
var lines = input.split('.');
var vari1 = lines[0]; // output: [100
var vari2 = lines[1]; // output: 100]
var data = {'x':vari1+"."+vari2};
$.ajax({
url: "checkAvailability.php",
type: 'POST',
data : {data:JSON.stringify(data)},
success : function(data) {
alert(data);
}
});
checkAvailability.php:
$data = $_POST['data'];
$data = json_decode($data,true);
if($availabilityChecker->check_availability($data['x'])) {
echo json_encode(array("error" => "is ok", "result"=>1));
} else {
echo json_encode(array("error" => "not ok", "result"=>0));
}
but than i get:
Call to a member function check_availability() on a non-object
for this line:
if($availabilityChecker->check_availability($data['x'])) {
i just want to get this string "100.100" in my check_availability-function, how to do this? greetings
Upvotes: 0
Views: 57
Reputation: 31634
in your PHP, it sounds like $availabilityChecker
is a simple variable or an array. You're trying to call a method inside that object but it's not one to call. To be an object instance it needs to have something like
$availabilityChecker = new Class();
Upvotes: 3