zota Posted March 11, 2016 Share Posted March 11, 2016 Hi! The following code does this:(a) $p survives to the test, (never echoes "stupid!") so (b) resend $p->textJSon, (believing on the browser's client side console) BUT ( c) does not save $value to $p->textJSon (both reload and back side prove it) The puzzle: how can (b) and © been compatible? Thanks(btw: $p should not be necessary, as I post to "./". So $page should be enough, right? But result was exactly - or looks - the same) <?php if($config->ajax) { $value = json_decode(file_get_contents('php://input')); $p = $pages->get("/hot/"); if (!($p instanceof NullPage)) { $p->of(false); $p->textJSon = $value; echo json_encode($p->textJSon, JSON_UNESCAPED_UNICODE) ; } else { echo 'stupid!' ; } return; } else { ... include head, foot, and so... Link to comment Share on other sites More sharing options...
adrian Posted March 11, 2016 Share Posted March 11, 2016 You don't appear to be saving the page anywhere, so do this: $p->save('textJSon'); after you set the $value 1 Link to comment Share on other sites More sharing options...
zota Posted March 11, 2016 Author Share Posted March 11, 2016 Tx Adrian, besides the save, there was another json_encode bug Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now