R
R
raycheel2015-08-15 23:20:29
JavaScript
raycheel, 2015-08-15 23:20:29

How to get the data and populate the object?

Hello! There is a javascript client that fills certain areas on the site with content. Filling occurs, approximately, as follows:

this.data.text = data.text;
this.textArea.setValue(this.data.text);

where this.data.text is the data stored like this:
window.data = {
"text" = {},
....
}

Question: when getting data from the database, how to fill in the window.data object? Is it possible to do this without ajax? What options are there? Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Ineshin, 2015-08-16
@IonDen

When loading a page, you can generate it on the server. This includes this design:

<script>
window.data = {
    ...
};
</script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question