The situation is this. I want to send a JS object as a JSON to a php page with a link to it. This new page is generated just from the transferred data.

I will give an example. There is a JS object

{ {id: 1; name: 'Вася'}, {id: 2; name: 'Маша'} } 

I send it to the handler, I build a table of these objects and I want to go to the page with this table.

I can send an ajax request object to this page, process it, but how can I make the transition to this page with already processed data?

Tried the submit button to wrap the form. The effect is necessary, the data is sent, the transition is carried out, but as in the previous case there are no data on the page

  • Write to sukesss location.href=URL . Rejoice - Alexey Shimansky
  • In sense in xhr.onreadystatechange at the answer 200? But in that case, how do I get access to the already created table? - Sergey
  • @ Sergey and on which side are you building the table? If on the server, then you don't care if you go to the page, data from the server will come with a ready-made table - Vasily Barbashev
  • @ Vasily Barbashev on the server. The question is, how do I get to this page, to which I am sending a request? - Sergey
  • @ Sergey The first comment from Alexey speaks to you about this. Yes, and in the next comment you wrote the event after which the transition should proceed. You think correctly) You do on the onready your request, and if the result is correct (you need it) go to the page - location.href = 'someUrl' . - Vasily Barbashev

1 answer 1

The rules of the websites are very simple.

If the information transferred to the page is not saved , but serves only to build information on this very page, then the GET method should be used. In this case, no jason, and the usual string through the ampersand.

If the information transmitted to the page is stored in the database, then we first write down, we get a unique page identifier, which will show us the saved information, and redirect to it.

  • Thanks, get for me is not suitable, since the json string can be very big - Sergey