Skip to content
Advertisement

Send two variables to js via php

I have

JavaScript

I am receiving via ajax an id:

JavaScript

Then on front end I click and send an ID and I need to check if:

JavaScript

So I try:

JavaScript

Then on ajax success I do:

JavaScript

How can I send 2 variable on echo json_encode($count); in order to do a double check for “is ID in the array? Is the array less than 2?” or is it there another way I’m missing?

Advertisement

Answer

the simple way to do is use in_array() along with array output:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement