get_template_part not working with ajax
I loaded some contents by ajax, When i try something like this:
$resp = array(
'success' = true,
'data' = 'the content here'
);
it's working without any issues but if i used something like this:
$resp = array(
'success' = true,
'data' = get_template_part( 'templates/update', 'profile' )
);
it gives me SyntaxError: JSON.parse: unexpected keyword at line 1 column 1 of the JSON data.
the content here{"success":true,"data":null}
What's the problem with get_template_part?
Topic get-template-part php Wordpress
Category Web