-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
I am looking to do the following:
`
Client Side
function select() {
var id = $('#My-ID-Input').val();
$.ajax({
type: 'post',
url: '/id',
data : {
id : id
},
success: function(data) {
var id = data.id;
$('#My-ID-Input').val(id);
},
error: function(err) {
console.log(err);
}
});
}
Server Side
app.post('/id', function(req, res) {
var data = req.body;
var id = data.id;
var query = "SELECT * FROM Control WHERE id=" + id;
connection.query(query, function(error, result) {
console.log(result);
res.send(result);
});
});
`
In the above example inside the "connection.query" I am thinking of saving data from form into a parse server app.
So HTML form > ajax with jquery > node server > save object from form to parse server app?
So if I replace the ajax with something like the following
https://www.parse.com/questions/using-jquery-and-ajax-to-assign-uploaded-file-to-new-parse-object
`
$.ajax({
type: "POST",
beforeSend: function(request) {
request.setRequestHeader("X-Parse-Application-Id", 'YourAppIDkey');
request.setRequestHeader("X-Parse-REST-API-Key", 'YourRestAPIkey');
request.setRequestHeader("Content-Type", file.type);
},
url: serverUrl,
data: file,
processData: false,
contentType: false,
success: function(data) {
`
How do I direct it to the right cloudcode function to define and save the object?
Or should I do something like this:
http://stackoverflow.com/questions/2138527/php-curl-http-post-sample-code
Just looking for a bit of guidance any help is appreciated.