M
M
myskypesla2016-09-16 12:52:30
JavaScript
myskypesla, 2016-09-16 12:52:30

How to load data into blocks when clicking on a menu item?

Hello everyone, there is such an example: https://jsfiddle.net/vwnz8avv/
The content will change on the page when you click on a menu item without reloading the page
. I will have about 20 such items with different text in the content block. The design is the same everywhere, the text and pictures will just change.
Tell me how to implement this correctly?
Maybe there are some template engines or is there a simple solution without react and angular? Or is it better to use them? Or is it better to store everything in data.json?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Rsa97, 2016-08-19
@Rsa97

And what is incomprehensible here? The script expects JSON from the server, but, judging by the error, it receives HTML.

P
Pavel Volintsev, 2016-08-19
@copist

Look at the error log on the server - most likely there was an error (exception), which as a result was displayed in HTML format, not JS or JSON
Look at the "Network" panel in Google Chrome - there may be an entry with the code 4xx or 5xx - this is an error
AND look at the response text - there may be HTML instead of JS
ed296226618d458ba43dadaa33f29481.png

R
rejjer, 2016-09-16
@rejjer

Ajax

I
Igor Voronov, 2016-09-16
@ivoronov

Learning what SPA is :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question