Trying for formulate a jquery $.POST() to API
-
I have a large data set
{
"WORKORDER_HEADER": [{
"WORKORDER_ID": 108,
"CUSTOMER_ID": "15790",
"CNAME": "A.J. SportsWorld",
"DATEREQUIRED": "2016-10-19",
"SHIPPINGMETHOD_ID": "2",
"ORDERTYPE_ID": "2",
"PAYMENTTYPE_ID": "2",
"CREDITCARDTYPE_ID": "2",
"CREDITCARDNUMBER": "4500123456789012",
"CARDHOLDERNAME": "Josh Pelchovitz",
"CREDITCARDEXPIRY": "05-20",
"CREDITCARDCVV": "354",
"SHIPPINGFEE": "0.0000",
"INSURANCEFEE": "0.0000",
"SALESREP_ID": null,
"WORKORDERDETAILS": "No Holos",
"CREATEDBY": null,
"CREATEDDATE": null,
"LASTEDITEDBY": null,
"LASTEDITDATE": null,
"contactfirstname": "Josh",
"contactlastname": "Pelchovitz",
"cbaddr1": "214 Beverley Glen Blvd",
"cbaddr2": "",
"cbcity": "Vaughan",
"cbprov": "ON",
"cbpcode": "L4J 7T5",
"cbcountry": null,
"WORKORDER_TOTAL":89,
"ITEMS": [{
"WORKORDER_ID": 108,
"CUSTOMER_ID": "15790",
"CNAME": "A.J. SportsWorld",
"DATEREQUIRED": "2016-10-19",
"SHIPPINGMETHOD_ID": "2",
"ORDERTYPE_ID": "2",
"PAYMENTTYPE_ID": "2",
"CREDITCARDTYPE_ID": "2",
"CREDITCARDNUMBER": "4500123456789012",
"CARDHOLDERNAME": "Josh Pelchovitz",
"CREDITCARDEXPIRY": "05-20",
"CREDITCARDCVV": "354",
"SHIPPINGFEE": "0.0000",
"INSURANCEFEE": "0.0000",
"SALESREP_ID": null,
"WORKORDERDETAILS": "No Holos",
"CREATEDBY": null,
"CREATEDDATE": null,
"LASTEDITEDBY": null,
"LASTEDITDATE": null,
"ITEM_ID": 385,
"PLAYER_ID": "581",
"TEAMNO": "12",
"EVENT_ID": "37",
"ITEMTYPE_ID": "1",
"CUSTOMERSUPPLIED": 0,
"UNIT_PRICE": "39.0000",
"QTY_ORDERED": "1",
"PENTYPE_ID": "3",
"PENCOLOR_ID": "30",
"SPECIALINSTRUCTIONS": "NYI Auto Model Puck",
"pentypedesc": "SHARPIE",
"pencolorname": "BLUE",
"itemdescription": "PHOTO 8 X 10",
"FIRSTNAME": "Denis",
"LASTNAME": "Potvin",
"TEAMNAME": "Islanders",
"TEAMCITY": "New York",
"EVENTNAME": "Public Signing - Summer 2017"
}, {
"WORKORDER_ID": 108,
"CUSTOMER_ID": "15790",
"CNAME": "A.J. SportsWorld",
"DATEREQUIRED": "2016-10-19",
"SHIPPINGMETHOD_ID": "2",
"ORDERTYPE_ID": "2",
"PAYMENTTYPE_ID": "2",
"CREDITCARDTYPE_ID": "2",
"CREDITCARDNUMBER": "4500123456789012",
"CARDHOLDERNAME": "Josh Pelchovitz",
"CREDITCARDEXPIRY": "05-20",
"CREDITCARDCVV": "354",
"SHIPPINGFEE": "0.0000",
"INSURANCEFEE": "0.0000",
"SALESREP_ID": null,
"WORKORDERDETAILS": "No Holos",
"CREATEDBY": null,
"CREATEDDATE": null,
"LASTEDITEDBY": null,
"LASTEDITDATE": null,
"ITEM_ID": 407,
"PLAYER_ID": "673",
"TEAMNO": "4",
"EVENT_ID": "37",
"ITEMTYPE_ID": "7",
"CUSTOMERSUPPLIED": 1,
"UNIT_PRICE": "50.0000",
"QTY_ORDERED": "1",
"PENTYPE_ID": "1",
"PENCOLOR_ID": "5",
"SPECIALINSTRUCTIONS": "TML 100th Anniversary Game Model Puck",
"contactfirstname": "Josh",
"contactlastname": "Pelchovitz",
"cbaddr1": "214 Beverley Glen Blvd",
"cbaddr2": "",
"cbcity": "Vaughan",
"cbprov": "ON",
"cbpcode": "L4J 7T5",
"cbcountry": null,
"pentypedesc": "PAINT - MEDIUM",
"pencolorname": "SILVER",
"itemdescription": "PUCK",
"FIRSTNAME": "Brendan",
"LASTNAME": "Shanahan",
"TEAMNAME": "Maple Leafs",
"TEAMCITY": "Toronto",
"EVENTNAME": "Public Signing - Summer 2017"
}]
}]
}How do I do a proper $.POST() to get this report back as a PDF ?
It works fine in designer , now I want to call the report from another webpage .....My js reports server runs on port 5000 while website runs on port 80
I managed to make a javascript variable of the huge "json text" above
as I have just started using this, I am trying to HARDCODE send this json as a variable ...So ...................
iData variable was built to hold all the json text above
var lcRequest='{"template":{"shortid":"rkdTO-EjZ"},"data":"'+iData+'"}';$.ajax({ url:'http://localhost:5000/api/reports', type:"POST", data:lcRequest, contentType:"application/json; charset=utf-8", dataType:"json", success: function(result){ alert(result) } });
-
hi! you can get an idea of how to do it by looking into the code of our browser sdk, here you will find how to send the request and handle the response. Our client is using plain
XMLHttpRequest
object but you can easily write equivalent code using jquery.