kreativan
1/27/2018 - 1:57 PM

Processwire GraphQL

Processwire GraphQL

$(document).ready(function() {
  
    $('#some_id').on('click', function(e) {
 
        $.post(
            '<?=$pages->get('/graphql/')->url?>', // this is the url where your GraphQL api is exposed.
            {
                query: `{ model { list { id, title } } }` // this is query
            },
            function (result) {
                 // do saomething with feched data
                console.log(result);
            }
        )
        .done(function() {
            // do something when done
            console.log("Done!");
        });
 
    });
  
});