Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Client-Side:
- $('form').submit(function (e) {
- e.preventDefault();
- $.post(
- //placeholder text
- $.ajax({
- var s2 = true;
- type: 'POST',
- url: '/add',
- data: {NEWDATA : DATA_OBJECT_TO_BE_SENT_BACK_TO_SERVER},
- dataType: "jsonp"
- });
- }
- );
- });
- Server-Side:
- app.post('/', function (req, res) {
- var placeholder = 1;
- res.send({placeholder : placeholder});
- if (s2) {
- function (data) {
- console.log(data.NEWDATA);
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement