php - jQuery Ajax Request fails to bring all data with SQL Query to fields

Solution:

you have to save your first category value to session and use it for second time ajax call. As per your code you always get trim($request) == 1 because each time ajax call it consider as new request. So use session or cookie for store and use parent category.

Answer

Solution:

Solved the problem by clearing and reinserting my database values and following @Foramkumar Patel's answer

EDIT: Cancel that, problem was with scandinavian letters in the response from JSON causing many different problems, solved the problem by utf_8 encoding the response.

Source