這裏我陣列格式如何通過Ajax POST請求的graphQl服務傳遞對象的數組
coordinates : [ { divId:"1234", divCor: { divleft:"1223", divtop: "455" }, imgCor: { imgleft:"78895", imgtop: "452"
} }, { divId:"1234", divCor :{ divleft:"1223", divtop: "455", }, imgCor :{ imgleft:"78895", imgtop: "452",
} }
]
我的Ajax請求是
`
var data = "mutation M{publishProduct(coordinates: "+this.state.coordinates+"){_id}}";
console.log("publishProduct: "+JSON.stringify(data));
$.ajax ({
type: "POST",
url: "/",
contentType: "application/graphql",
data: data,
dataType : 'json',
success:(data) => {
`
控制檯我保持在上面顯示爲
publishProduct: "mutation M{publishProduct(coordinates: [object Object],[object Object],[object Object]){ _id}} // Before passing data
`
它不經過我所需要的格式。
請幫助我如何傳遞graphQl請求的對象數組。
這看起來很簡單,我一定會做一個嘗試。謝謝。 – Goutham