There is a script to send a GET request:

$.ajax({ url:'/accounts/' + id, type:'GET', success: function(data){ console.log(data); if(data) { console.log('Success'); } else { console.log('No data received from server'); } }, error: function(){ alert('It was not possible to connect the server'); } }); 

The script is executed successfully and in the form of data receives the html file with the code of the requested page. The text of this file is displayed in the console, but how can it be displayed as a page? One could, of course, just make the transition to the desired page top.location.href = 'accounts/' + id . But the fact is that here is a simplified version of the script. In fact, a GET request should be sent with parameters that identify the user with the specified id (login and password). If you send them in the line top.location.href = 'accounts/' + id , then they will be displayed in the address bar of the browser.

  • if I understand you correctly, do you want to display the result of an ajax request on the same page in a specific block? - Bald
  • No, put the answer in the div on the same page is obtained, but I would like to show the resulting page in a separate window. - vitaliy4us
  • why not redirect to the right page? - Bald
  • Well, the situation there is still unresolved. It should be redirected to the user’s page, which should receive a login and password, and if redirected, it is necessary to specify them through the parameters and they are then visible in the browser. - vitaliy4us
  • And to transfer parameters through POST, what's the problem? - br3t

1 answer 1

Found, perhaps not the best option with a pop-up page:

 var newWin = window.open("about:blank", "hello", "width=500,height=700"); newWin.document.write(data); 

Although, browser popup pages usually block ...