Forum

Thread tagged as: Question, Discussion

AJAX and JSON with perch

Is it possible to utilise ajax and json within perch to create a single page sort of app experience?

Thanks

Paul Langley

Paul Langley 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you mean within Perch, or do you mean on your website where the content is managed by Perch?

yeah on the front end so have perch produce json

Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that's no problem. The simplest way is probably to use perch_content_custom() and the skip-template option.

echo json_encode(
    perch_content_custom('Region name', array(
         'skip-template' => true,
    ));
);

Wow this is great! So simple!!!!