Closed sabsaxo closed 6 years ago
Because data
is not JSON
--> String
!!!! It's Object
.
Now, even that comment I don't understand. What is object?
What do you mean by JSON --> String
?
object
is object
. JSON
is meant as a string (because JSON is the string) but the framework performs a simple JSON validation. Change json
to object
and everything will work as you expect.
So, what you're telling me is: that I should CHANGE 'JSON' to 'OBJECT'?
JSON --> String
didn't make any sense.
According to the 'docs' JSON is defined as "JSON", so the 'docs' may be confusing ...
OK, otherwise: WHAT IS JSON
?
An object. So why can I define something as 'JSON' when I should be using 'OBJECT'? It's confusing at best.
No, JSON is not OBJECT, it's String!
True, but I was expecting the data to be an object when passed to the model on the server – and behaving as such. I think I'm simly confused about what's going on 'behind the scenes (Schemes ; ) )'
But thanks for clearing that out ...
I'm passing data to the server through AJAX, but when I try to access my data in the model (a Schema) using the $clean method, my 'data' becomes
undefined
. Why is that, and HOW do I prevent this from happening?This is the data I pass from the client:
This is what I do in my controller:
I've defined the fields in the Schema like this (tried both with and without the quotes around the data types):
And this is what I get in the controller:
Notice how 'data' is undefined, but is clearly in the passed in data.
It seems like the framework cannot properly handle nested JSON objects!?