V
V
vanek_parenek2021-04-19 14:55:06
PHP
vanek_parenek, 2021-04-19 14:55:06

Is it possible to upload data to a multi-page site using api?

I would like to know if I can use the API on a multi-page site. Or is using the API only relevant when developing a SPA?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MikUrrey, 2021-04-19
@MikUrrey

Why not?)
The server can do this:

if (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
  //вот тебе данные в виде JSON
} else {
  //а вот тебе те же данные, но в виде HTML
}

V
Vasily Bannikov, 2021-04-19
@vabka

Yes, it is possible, and even necessary, so as not to reload the page for every sneeze.
It used to be called "ajax" (although it's still called now)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question