I think you have used echo json_encode($relationships)
in your household.php
file. You don't need to parse the response (which you used) because you already wrote the dataType
to json
. It will convert automatically. Hope this answer helps you. According to the jQuery Manual, "Any malformed JSON will be rejected and raise a parsing error. As of jQuery 1.9, empty responses will also be rejected." Therefore, you can just use dataType: 'json' if you are sure that the server will return correctly formatted JSON. If it just returns "a string that looks like JSON", you should use dataType: "text json" to force jQuery to convert.
[Note] If the above answer doesn't help you, I recommend you to use this function to parse the response. var data = jQuery.parseJSON(response);
or var data = $.parseJSON(response)