0

I tried in 2 ways:

saving the json on a var

var dataLog = JSON.stringify( {
  "clientId": "1",
  "sensor": "Temp",
  "dateStart": "2016-09-03 00:00:00",
  "dateEnd": "2016-09-03 00:59:59"
} );

$.post(data , {dataLog})
  .done(function( data ) {
  console.table(data);
});

and adding the same json directly into the data parameter

$.post( url, {
  "clientId": "1",
  "sensor": "Temp",
  "dateStart": "2016-09-03 00:00:00",
  "dateEnd": "2016-09-03 00:59:59"
})
  .done(function( data ) {
  console.log(data);
});

but none of the 2 options works, it is possible or im doing something wrong?

Gil
  • 701
  • 1
  • 9
  • 20

1 Answers1

1

here one example

var promise = $.ajax({
            url: url,
            type: 'POST',
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            data: dataLog
});
Ro.
  • 1,525
  • 1
  • 14
  • 17