javascript - Pebble.js ajax request with post data. No data in request -


i started fiddeling pebble.js prototype. have make connection server , send user data pebble (login information) server handshake , send data server pebble. using pebble.js because easy prototyping.

now using ajax library (http://developer.getpebble.com/docs/pebblejs/#ajax) setup connection. have following code:

ajax( {   url: url,   method: 'post',   type: 'json',   data: {     auth : 'test'   } }, function(data) {   // success!   console.log(json.stringify(data)); }, function(error) {   // failure!   console.log('no response'); } ); 

in php on server complete header information apache_request_headers(); , send pebble echo json_encode(apache_request_headers());

this results in output of console.log(json.stringify(data))

{"host":"192.168.0.113","content-type":"application/json","accept":"*/*","connection":"keep-alive","cookie":"v2ci_session=55mmppmzb2cvbwiq3vngnehexyzbtifr46ycb94s2knkwmnz%2fstjq3eulpusubmbskmkou2915zr5cp%2fa7xxnk7fo5ehcnem3xi6glpajpxcf51sqxvqn%2bp1famldqezsnzevkbhao3lkzzaldnjzuc2spyrcdvx70xankohqvh%2buau7qztlctywj7myqqwa1%2bxupfw9vb7vgduyqowmb%2fviab5udpe1knixz08reu1phvtwxcxxygcewmyfcydkxzsih%2fcnm%2b4okau3kealgx9jxevvc6vkz4madg7o5q4ns%2bekytr5vqrpisfzcy2vwox8ipjcuymttosy9lm%2f0qspu4p%2b2obuxcbsjiyvik2esqqj6%2bwno0l3dek6l2n7","user-agent":"pebbleapp/20141016231206 cfnetwork/711.1.12 darwin/14.0.0","accept-language":"nl-nl","accept-encoding":"gzip, deflate","content-length":"6"} 

as can see no data send within request.

anyone have idea why no data send request?

solved

i able solve through github of pebblejs. people same problem: when 'type' set 'json' ajax library not expect response json, data posted posted json. if want gather data in array in php use following code:

json_decode(file_get_contents('php://input'), true);  


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -