Matt6607699
Posts: 0
Joined: Sat Jan 25, 2014 7:18 am

How do you send parameters to Server code using POST?

HI, I use Appery Server Code and Database for my Website and need to send a dataUrl as one of the parameters for the server script to use to update a picture to my db. The dataUrl is too long to be included in the url so I get an error saying that the uri is too long. Is there a way to us POST and retrieve the sent data in server script?

I tried this and got a 200 but I don't know how to retrieve the data to use in server code. I'm guessing that it's not retrieved with x = request.get("pic")?

code
$.ajax({
url: "https://api.appery.io/rest/1/code/c7ea3f85-bc86-4472-a48b-1c25a03824e0/exec?",
type:'POST',
data: {
ID:localStorage.getItem('profileDbId'),
pic: dataUrl
},
processData: false,
contentType: false,
success: function(data) {
console.log("success");
},
error: function(data) {
// do something in case of an error...
}
});//End of ajax
/code

"success" is logged to the console but how do I retrieve the ID and pic data in server code?

Matt6607699
Posts: 0
Joined: Sat Jan 25, 2014 7:18 am

How do you send parameters to Server code using POST?

Excellent, thank you. That worked out using request.body()

Return to “Issues”