0

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

1
  • 2
    Well, the error is clear. You didn't create the $availbilityChecker object. Where do you initialize it? Commented Nov 25, 2013 at 19:25

1 Answer 1

3

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();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.