-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No data posted when type is 'json' #10
Comments
It will post the data as json but not as urlencoded form data. This is a common way to do this for json webservice but maybe not what you were expecting. See: https://github.com/pebble/pebblejs/blob/develop/src/js/lib/ajax.js#L84-L86 |
Thanks for responding Thomas. That's right, the 'json' type is when both client and server use json. Similarly, 'form' is when both use form. Thus type is a convenience parameter for when only a single format is used throughout. In the case of sending form data and receiving json data, leaving the type undefined or specifying 'text' and using I'll be sure to make this more clear in the documentation. |
Interesting. It would be good to put it in the documentation that the output is also changed by the 'type'. I am now storing the data from the ajax request in php with the following code: json_decode(file_get_contents('php://input'), true); |
Thanks, the documentation has been updated! It sort of shoves a lot of into into that little box -- I should structure it better in the future. |
When posting data through ajax with the following setup:
Php is not receiving any post data. Shouldn't the Content-Type header be application/x-www-form-urlencoded as it is sending data? Now it is specifically set to 'application/json' in the code, which doesn't post the data?
The post data is send when the type is 'html'.
Please help me out, because I really dig Pebble.js
The text was updated successfully, but these errors were encountered: