标签:send xhr turn cep span des return ring XML
var numSides = 6; var numRolls = 3; var xhr = new XMLHttpRequest(); xhr.responseType = ‘json‘; xhr.open("POST", "http://localhost:4000/graphql"); xhr.setRequestHeader("Content-Type", "application/json"); xhr.setRequestHeader("Accept", "application/json"); xhr.onload = function () { console.log(‘data returned:‘, xhr.response); } var query = `query getDiexx($numSides:Int!,$numRolls:Int!) { getDie(numSides: $numSides) { numSides roll(numRolls: $numRolls) } }`; xhr.send(JSON.stringify({ query: query, variables: {numSides: numSides, numRolls: numRolls}, }));
标签:send xhr turn cep span des return ring XML
原文地址:http://www.cnblogs.com/or2-/p/7543235.html